5.2.2.3位图索引不适合更新操作 建立第一个链接: sqlplus ljb/ljb select sid from v$mystat where rownum=1; insert into t(name_id,gender,location,age_group,date) values(100001,'M',45,'child',rpad('*',20,'*'));
建立第二个链接:(不能插入) sqlplus ljb/ljb select sid from v$mystat where rownum=1; insert into t(name_id,gender,location,age_group,date) values(100002,'M',46,'young',rpad('*',20,'*')); 建立第三个链接:(又能成功插入) sqlplus ljb/ljb select sid from v$mystat where rownum=1; insert into t(name_id,gender,location,age_group,date) values(100003,'F',47,'Middle_age',rpad('*',20,'*')); 建立第四个链接:(不能插入) sqlplus ljb/ljb select sid from v$mystat where rownum=1; insert into t(name_id,gender,location,age_group,date) values(100003,'F',48,'old',rpad('*',20,'*'));
第一次插入gender=’M'的记录,未提交前,再有新的session插入gender='M'的记录就会卡住,而插入gender='F'的记录就可以。不支持高并发。
删除location,age_group位图索引: rollback;(4个会话) drop index location_idx; drop index age_group_idx;
测试锁: 第一个会话: delete from t where gender='M' and location=25; 第二个会话:(插入带M的记录被阻挡,一下语句3个语句都会被阻止) insert into t (name_id,gender,location,age_group,date) values(100001,'M',78,'young','TTT'); update t ser gender='M' where location=25; delete from t where gender='M'; (以下不进行阻止,update 只要不更新位图索引所在的列即可): insert into t (name_id,gender,location,age_group,date) values (100001,'M',78,'young','TTT'); delete from t where gender='F'; update t set location=100 where rowid not in (select rowid from t where gender='F' and location=25); |