国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

腳本示例:查看數據庫中有無多余的索引SQL

2024-07-21 02:43:55
字體:
來源:轉載
供稿:網友
查看數據庫中有無多余的索引,即一個索引的字段為另一個索引的前幾個字段。如index1的定義為test(filed1,filed2),index2的定義為test(filed1,filed2,filed3),則認為index1是多余的。(摘自Ixora)

column redundant_index format a39

column sufficient_index format a39

select /*+ ordered */

o1.name||'.'||n1.name redundant_index,

o2.name||'.'||n2.name sufficient_index

from

(

select

obj#,

bo#,

count(*) cols,

max(decode(pos#, 1, intcol#)) leadcol#

from

sys.icol$

group by

obj#,

bo#

) ic1,

sys.icol$ ic2,

sys.ind$ i1,

sys.obj$ n1,

sys.obj$ n2,

sys.user$ o1,

sys.user$ o2

where

ic2.obj# != ic1.obj# and

ic2.bo# = ic1.bo# and

ic2.pos# = 1 and

ic2.intcol# = ic1.leadcol# and

i1.obj# = ic1.obj# and

bitand(i1.PRoperty, 1) = 0 and

ic1.cols * (ic1.cols + 1) / 2 =

( select

sum(xc1.pos#)

from

sys.icol$ xc1,

sys.icol$ xc2

where

xc1.obj# = ic1.obj# and

xc2.obj# = ic2.obj# and

xc1.pos# = xc2.pos# and

xc1.intcol# = xc2.intcol#

) and

n1.obj# = ic1.obj# and

n2.obj# = ic2.obj# and

o1.user# = n1.owner# and

o2.user# = n2.owner#

/


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 收藏| 密云县| 衡水市| 新绛县| 屯门区| 卢氏县| 鄂伦春自治旗| 南昌县| 南江县| 上林县| 温泉县| 扶余县| 泗水县| 门源| 贵溪市| 惠来县| 宁安市| 时尚| 临桂县| 达尔| 巴彦县| 剑河县| 上蔡县| 香格里拉县| 封开县| 定州市| 合阳县| 凌海市| 奉化市| 岳阳县| 莎车县| 连南| 广丰县| 锡林浩特市| 泰州市| 永登县| 扬州市| 静安区| 义乌市| 多伦县| 静安区|