mysql创建Bitmap_Join_Indexes中的约束与索引

很文博客hinvn.com 数据库评论49字数 773阅读模式
广告也精彩

现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。原因:受到约束与索引的影响。

测试过程如下:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

create table sales文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

as select * from sh.sales;create table customers文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

as文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

select * from sh.customers;文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

create unique index CUST_ID_un on customers(CUST_ID);文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

创建:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/61141.html

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;

报错如下:

第 3 行出现错误:

ORA-25954: 维的主键或唯一约束条件缺失

案例分析:在此处尽管定义了对表customers的唯一性索引,但是该索引并没有对表customers并没有唯一性约束,即表示唯一性索引并不表示对表进行唯一性约束;但是如果加了唯一性的约束,就不会出现报错,示例如下:

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;

索引已创建。

结论:

只要加了唯一性的约束,创建BJI则不会报错。

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
  • Bitmap_Join_Indexes , MySQL
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证