The constraints and indexes in Mysql creation Bitmap_join_indexes _mysql

Source: Internet
Author: User
The test process is as follows:
CREATE TABLE Sales
As SELECT * from Sh.sales;

CREATE TABLE Customers

As
SELECT * from Sh.customers;
Create unique index Cust_id_un on customers (cust_id);


Create:
Bitmap Join Indexes

Create Bitmap Index Sales_cust_gender_bjix
On sales (Customers.cust_gender)
From Sales,customers
where sales.cust_id=customers.cust_id;

The error is as follows:


Line 3rd Error:
ORA-25954: The primary KEY or UNIQUE constraint for the dimension is missing
Case study: Although the uniqueness index for table customers is defined here, the index does not have a uniqueness constraint on the table customers, that is, the uniqueness index does not represent a uniqueness constraint on the table, but if the uniqueness constraint is added, the error will not occur, as shown in the following example:


Sql> ALTER TABLE Customers
2 MODIFY (cust_id CONSTRAINT customers_un unique);
The table has changed.

Sql> Create bitmap Index Sales_cust_gender_bjix

2 on sales (Customers.cust_gender)
3 from Sales,customers
4 where sales.cust_id=customers.cust_id;


The index has been created.



Conclusion:

Creating a Bji is not an error, as long as the uniqueness constraint is added.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.