午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術(shù)文章
文章詳情頁

關(guān)于Oracle 9i 跳躍式索引掃描(Index Skip Scan)的小測試

瀏覽:18日期:2023-11-18 15:12:02
在Oracle9i中我們知道能夠使用跳躍式索引掃描(Index Skip Scan).然而,能利用跳躍式索引掃描的情況其實是有些限制的.從Oracle的文檔中我們可以找到這樣的話:Index Skip Scans Index skip scans improve index scans by nonprefix columns. Often, scanning index blocks is faster than scanning table data blocks.Skip scanning lets a composite index be split logically into smaller subindexes. In skip scanning, the initial column of the composite index is not specified in the query. In other Words, it is skipped.The number of logical subindexes is determined by the number of distinct values in the initial column. Skip scanning is advantageous if there are few distinct values in the leading column of the compositeindex and many distinct values in the nonleading key of the index.也可以這樣說,優(yōu)化器根據(jù)索引中的前導(dǎo)列(索引到的第一列)的唯一值的數(shù)量決定是否使用Skip Scan.我們首先做個測試:SQL> CREATE TABLE test AS 2; SELECT ROWNUM a,ROWNUM-1 b ,ROWNUM-2 c,ROWNUM-3 d,ROWNUM-4 e 3; FROM all_objects 4; /SQL> SELECT DISTINCT COUNT (a) FROM test; COUNT(A)---------- 28251表已創(chuàng)建。SQL> SQL> CREATE INDEX test_idx ON test(a,b,c) 2; /索引已創(chuàng)建。SQL> ANALYZE TABLE test COMPUTE STATISTICS 2; FOR TABLE 3; FOR ALL INDEXES 4; FOR ALL INDEXED COLUMNS 5; /表已分析。SQL> SET autotrace traceonly eXPlainSQL> SELECT *; FROM test WHERE b = 99 2; /Execution Plan---------------------------------------------------------- 0;;;SELECT STATEMENT Optimizer=CHOOSE (Cost=36 Card=1 Bytes=26) 1;0;TABLE Access (FULL) OF 'TEST' (Cost=36 Card=1 Bytes=26)--可見這里CBO選擇了全表掃描.--我們接著做另一個測試:SQL> drop table test;表已丟棄。SQL> CREATE TABLE test 2; AS 3; SELECT DECODE(MOD(ROWNUM,2), 0, '1', '2' ) a, 4;ROWNUM-1 b, 5;ROWNUM-2 c, 6;ROWNUM-3 d, 7;ROWNUM-4 e 8;FROM all_objects 9; /表已創(chuàng)建。 SQL> set autotrace offSQL> select distinct a from test;A--12--A列只有兩個唯一值SQL> CREATE INDEX test_idx ON test(a,b,c) 2; /索引已創(chuàng)建。SQL> ANALYZE TABLE test COMPUTE STATISTICS 2; FOR TABLE 3; FOR ALL INDEXES 4; FOR ALL INDEXED COLUMNS 5; /表已分析。SQL> set autotrace traceonly explainSQL> SELECT *; FROM test WHERE b = 99 2; /Execution Plan---------------------------------------------------------- 0;;;SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=1 Bytes=24) 1;0TABLE ACCESS (BY INDEX ROWID) OF 'TEST' (Cost=4 Card=1 Bytes=24) 2;1;;INDEX (SKIP SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=3 Card=1)Oracle的優(yōu)化器(這里指的是CBO)能對查詢應(yīng)用Index Skip Scans至少要有幾個條件:1 優(yōu)化器認為是合適的.2 索引中的前導(dǎo)列的唯一值的數(shù)量能滿足一定的條件.3 優(yōu)化器要知道前導(dǎo)列的值分布(通過分析/統(tǒng)計表得到)4 合適的SQL語句......更多信息請參考:http://www.itpub.net/showthread.PHP?threadid=85948http://www.cnoug.org/bin/ut/topic_show.cgi?id=608&h=1&bpg=1&age=100http://www.itpub.net/showthread.php?s=&postid=985602#post985602Oracle9i Database Performance Tuning Guide and Reference Release 2 (9.2)Part Number A96533-02感謝參加討論的各位高手.
主站蜘蛛池模板: 香蕉久久综合 | 2024国产精品| 美女av在线免费观看 | 白嫩白嫩国产精品 | 精品成人一区二区 | 特级西西444www大精品视频免费看 | 欧美成人三级视频 | 国产免费专区 | 亚洲毛茸茸| 日韩天天干 | 在线视频成人 | 欧洲综合网 | 色av导航| 91网站观看 | 一级一级黄色片 | 在线观看免费黄色网址 | 国产精品成人在线 | 天堂色网 | 日韩中出在线 | 中文精品视频 | 在线免费看毛片 | 黄色视屏在线 | 欧美日韩后 | 精品九九九 | 国产精品黄色片 | 草久视频在线观看 | 四虎成人在线视频 | 成人在线国产 | 6699嫩草久久久精品影院 | 91成人久久 | 秋霞欧美视频 | 成人免费av网站 | 成人xxx | 久久精品中文字幕 | 中国成人毛片 | 国产手机在线 | 一级黄色在线视频 | 网站黄在线 | 亚洲国产大片 | 高清免费av | 午夜激情小视频 |