虚拟索引

查看数据库有没有创建对应的虚拟索引,可以使用下面SQL语句查询。

 

SELECT INDEX_OWNER, INDEX_NAME
  FROM DBA_IND_COLUMNS
 WHERE INDEX_NAME NOT LIKE 'BIN$%'
MINUS
SELECT OWNER, INDEX_NAME
  FROM DBA_INDEXES;
 
--或下面SQL(下面SQL在有些情况下有bug)
 
SELECT O.OBJECT_NAME AS FAKE_INDEX_NAME 
FROM   DBA_OBJECTS O 
WHERE  O.OBJECT_TYPE = 'INDEX' 
       AND NOT EXISTS (SELECT NULL 
                       FROM   DBA_INDEXES I 
                       WHERE  O.OBJECT_NAME = I.INDEX_NAME 
                              AND O.OWNER = I.OWNER);

 

posted @ 2019-12-09 21:17  耀阳居士  阅读(167)  评论(0编辑  收藏  举报