mysql creates constraints and indexes in Bitmap_Join_Indexes

  • 2020-05-06 11:48:40
  • OfStack

The test process is as follows:
create   table   sales  
as   select   *   from   sh;        

create   table   customers  

as  
select   *   from   sh;  
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 reported as follows:  


An error occurred on line   3  :  
Es66en-25954:   dimension with primary key or unique constraint missing
Case study: although a unique index of table customers is defined here, the index does not have a unique constraint on table customers. However, if a uniqueness constraint is added, no error is reported, 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:

As long as the uniqueness constraint is added, BJI is created without error.  

Related articles: