当前位置: 首页 > 图文教程 > 数据库 > MYSQL > mysql创建Bitmap_Join_Indexes中的约束与索引

MYSQL
MySQL collation方法
mysql Myisamchk小工具使用手册
MySQL server has gone away错误提示解决方法
从其他电脑访问本机的Mysql的设置方法
mysql 卡死 大部分线程长时间处于sending data的状态
MySQL 存储过程和"Cursor"的使用方法
mysql 忘记密码的解决方法(linux和windows小结)
MySQL 编码机制
CMS不要让MySQL为你流泪
MySQL 数据类型和建库策略
MYSQL 数据库命名与设计规范
mysql 按中文字段排序
mysql proxy问题的解决方法
Mysql 数据库访问类
MySQL 数据库跨操作系统的最快迁移方法
MySQL 数据库的临时文件究竟储存在哪里
MySQL 优化设置步骤
mysql 终结点映射器中没有更多的终结点可用的解决方法
MYSQL WHERE语句优化
MySQL 服务器参数说明及查看 设置方法

MYSQL 中的 mysql创建Bitmap_Join_Indexes中的约束与索引


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 93 ::
收藏到网摘: n/a

现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。 53vi.Com 原因:受到约束与索引的影响。 测试过程如下:
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);

创建:
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则不会报错。