欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mysql創(chuàng)建Bitmap_Join_Indexes中的約束與索引

 更新時(shí)間:2008年04月07日 20:41:03   作者:  
現(xiàn)象:創(chuàng)建Bitmap Join Indexes時(shí)出現(xiàn)ORA-25954報(bào)錯(cuò): 維的主鍵或唯一約束條件缺失。 53vi.Com 原因:受到約束與索引的影響。
測(cè)試過(guò)程如下:
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);    


創(chuàng)建: 
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; 

報(bào)錯(cuò)如下: 


第 3 行出現(xiàn)錯(cuò)誤: 
ORA-25954: 維的主鍵或唯一約束條件缺失
案例分析:在此處盡管定義了對(duì)表customers的唯一性索引,但是該索引并沒(méi)有對(duì)表customers并沒(méi)有唯一性約束,即表示唯一性索引并不表示對(duì)表進(jìn)行唯一性約束;但是如果加了唯一性的約束,就不會(huì)出現(xiàn)報(bào)錯(cuò),示例如下:


SQL> ALTER TABLE customers
2 MODIFY (cust_id CONSTRAINT customers_un unique); 
表已更改。

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; 


索引已創(chuàng)建。 



結(jié)論:

只要加了唯一性的約束,創(chuàng)建BJI則不會(huì)報(bào)錯(cuò)。 

相關(guān)文章

最新評(píng)論