[20120514]Invisible Indexes and FK問題.txt
[20120514]Invisible Indexes and FK問題.txt
SQL> select * from v$version ;
BANNER
------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
CREATE TABLE t1 AS SELECT rownum id FROM dual CONNECT BY level <= 10;
CREATE TABLE t2 AS SELECT rownum id FROM dual CONNECT BY level <= 10;
ALTER TABLE t1 ADD CONSTRAINT t1_pk UNIQUE (id);
ALTER TABLE t2 ADD CONSTRAINT t1_t2_fk FOREIGN KEY (id) REFERENCES t1 (id);
CREATE INDEX i_t2_id ON t2 (id) INVISIBLE;
會話1:
INSERT INTO t2 VALUES (1);
會話2:
DELETE FROM t2 WHERE id = 2;
DELETE FROM t1 WHERE id = 2;
--測試發現,在這樣的情況下,會出現阻塞情況,
--修改索引visible,問題消失.
ALTER INDEX i_t2_id ON t2 (id) VISIBLE;
SQL> select * from v$version ;
BANNER
------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
CREATE TABLE t1 AS SELECT rownum id FROM dual CONNECT BY level <= 10;
CREATE TABLE t2 AS SELECT rownum id FROM dual CONNECT BY level <= 10;
ALTER TABLE t1 ADD CONSTRAINT t1_pk UNIQUE (id);
ALTER TABLE t2 ADD CONSTRAINT t1_t2_fk FOREIGN KEY (id) REFERENCES t1 (id);
CREATE INDEX i_t2_id ON t2 (id) INVISIBLE;
會話1:
INSERT INTO t2 VALUES (1);
會話2:
DELETE FROM t2 WHERE id = 2;
DELETE FROM t1 WHERE id = 2;
--測試發現,在這樣的情況下,會出現阻塞情況,
--修改索引visible,問題消失.
ALTER INDEX i_t2_id ON t2 (id) VISIBLE;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-723540/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 8 新特性之Invisible IndexesMySqlIndex
- Oracle之不可見索引(invisible indexes)Oracle索引Index
- [20200906][轉載]FK on delete.txtdelete
- [20180510]20 Indexes.txtIndex
- postgresql copy UNICODE txt 問題。SQLUnicode
- [20130721]ORACLE 12C Invisible Columns.txtOracle
- Invisible IndexIndex
- index , virtual , invisibleIndex
- 把TXT文字匯入SQLServer常見問題SQLServer
- Ubuntu11.10 亂碼問題(TXT)。Ubuntu
- [20130723]ORACLE 12C Invisible Columns的補充.txtOracle
- [20220414]Function based indexes and cursor sharing2.txtFunctionIndex
- [20202117]Function based indexes and cursor sharing.txtFunctionIndex
- Rebuild IndexesRebuildIndex
- ORACLE INDEXESOracleIndex
- [20160910]sqlldr使用問題.txtSQL
- java 讀取.txt檔案時,注意的問題Java
- [20121028]not in與NULL問題.txtNull
- [20160608]perf定位問題.txt
- 如何批量使外來鍵(FK)失效
- Oracle - Tables/IndexesOracleIndex
- Reverse Key IndexesIndex
- ORACLE -> NULL & INDEXESOracleNullIndex
- Overview of Partitioned IndexesViewIndex
- Local Partitioned IndexesIndex
- Global Nonpartitioned IndexesIndex
- Extents in Indexes (19)Index
- [20190221]sql patch 問題.txtSQL
- [20210812]windows xcopy問題.txtWindows
- [20220329]windows xcopy命令問題.txtWindows
- [20180509]函式索引問題.txt函式索引
- [20160809]exp語法問題.txt
- [20170725]vim呼叫bccalc外掛問題.txt
- [20130812]12c Partial Indexes For Partitioned Tables Part I.txtIndex
- [20130812]12c Partial Indexes For Partitioned Tables Part II.txtIndex
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- 解決macOS新建txt文件在Windows下不換行問題MacWindows
- [20181031]模擬網路問題.txt