oracle分割槽表執行計劃
執行計劃中的關鍵字
partition list single --掃描單個分割槽
partition list iterator --連續掃描N個分割槽
partition list inlist --不連續掃描N個分割槽
partition list full --掃描全部分割槽?
測試結果
SQL> drop table test purge;
SQL> remark 建立測試資料
SQL> CREATE TABLE test (id integer) PARTITION BY RANGE (id)
2 (PARTITION P1 VALUES LESS THAN (10),
3 PARTITION P2 VALUES LESS THAN (20),
4 PARTITION P3 VALUES LESS THAN (30),
5 PARTITION P4 VALUES LESS THAN (40),
6 PARTITION P5 VALUES LESS THAN (MAXVALUE)
7 );
SQL> insert into test values(1);
SQL> insert into test values(2);
SQL> insert into test values(11);
SQL> insert into test values(12);
SQL> insert into test values(21);
SQL> insert into test values(22);
SQL> insert into test values(31);
SQL> insert into test values(32);
SQL> insert into test values(41);
SQL> insert into test values(42);
SQL> commit;
SQL> analyze table test compute statistics;
SQL> set autot on explain;
SQL> remark 掃描單個分割槽
SQL> select * from test where id=1;
1
執行計劃
----------------------------------------------------------
Plan hash value: 3030469310
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 14 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE| | 1 | 2 | 14 (0)| 00:00:01 | 1 | 1 |
|* 2 | TABLE ACCESS FULL | test | 1 | 2 | 14 (0)| 00:00:01 | 1 | 1 |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"=1)
SQL> remark 不連續掃描多個分割槽
SQL> select * from test where id=1 or id=31;
1
31
執行計劃
----------------------------------------------------------
Plan hash value: 3679944805
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 4 | 27 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE INLIST| | 2 | 4 | 27 (0)| 00:00:01 |KEY(I) |KEY(I) |
|* 2 | TABLE ACCESS FULL | test | 2 | 4 | 27 (0)| 00:00:01 |KEY(I) |KEY(I) |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"=1 OR "ID"=31)
SQL> remark 連續掃描多個分割槽
SQL> select * from test where id between 1 and 32;
1
2
11
12
21
22
31
32
執行計劃
----------------------------------------------------------
Plan hash value: 1049729311
-------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 9 | 18 | 51 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE ITERATOR| | 9 | 18 | 51 (0)| 00:00:01 | 1 | 4 |
|* 2 | TABLE ACCESS FULL | test | 9 | 18 | 51 (0)| 00:00:01 | 1 | 4 |
-------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"<=32 AND "ID">=1)
SQL> remark 掃描全部分割槽
SQL> select * from test ;
1
2
11
12
21
22
31
32
41
42
執行計劃
----------------------------------------------------------
Plan hash value: 1271614465
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10 | 20 | 64 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE ALL| | 10 | 20 | 64 (0)| 00:00:01 | 1 | 5 |
| 2 | TABLE ACCESS FULL | test | 10 | 20 | 64 (0)| 00:00:01 | 1 | 5 |
--------------------------------------------------------------------------------------------
SQL> spool off;
出處:http://www.itpub.net/thread-1854955-1-1.html
partition list single --掃描單個分割槽
partition list iterator --連續掃描N個分割槽
partition list inlist --不連續掃描N個分割槽
partition list full --掃描全部分割槽?
測試結果
SQL> drop table test purge;
SQL> remark 建立測試資料
SQL> CREATE TABLE test (id integer) PARTITION BY RANGE (id)
2 (PARTITION P1 VALUES LESS THAN (10),
3 PARTITION P2 VALUES LESS THAN (20),
4 PARTITION P3 VALUES LESS THAN (30),
5 PARTITION P4 VALUES LESS THAN (40),
6 PARTITION P5 VALUES LESS THAN (MAXVALUE)
7 );
SQL> insert into test values(1);
SQL> insert into test values(2);
SQL> insert into test values(11);
SQL> insert into test values(12);
SQL> insert into test values(21);
SQL> insert into test values(22);
SQL> insert into test values(31);
SQL> insert into test values(32);
SQL> insert into test values(41);
SQL> insert into test values(42);
SQL> commit;
SQL> analyze table test compute statistics;
SQL> set autot on explain;
SQL> remark 掃描單個分割槽
SQL> select * from test where id=1;
1
執行計劃
----------------------------------------------------------
Plan hash value: 3030469310
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 14 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE| | 1 | 2 | 14 (0)| 00:00:01 | 1 | 1 |
|* 2 | TABLE ACCESS FULL | test | 1 | 2 | 14 (0)| 00:00:01 | 1 | 1 |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"=1)
SQL> remark 不連續掃描多個分割槽
SQL> select * from test where id=1 or id=31;
1
31
執行計劃
----------------------------------------------------------
Plan hash value: 3679944805
-----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 4 | 27 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE INLIST| | 2 | 4 | 27 (0)| 00:00:01 |KEY(I) |KEY(I) |
|* 2 | TABLE ACCESS FULL | test | 2 | 4 | 27 (0)| 00:00:01 |KEY(I) |KEY(I) |
-----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"=1 OR "ID"=31)
SQL> remark 連續掃描多個分割槽
SQL> select * from test where id between 1 and 32;
1
2
11
12
21
22
31
32
執行計劃
----------------------------------------------------------
Plan hash value: 1049729311
-------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 9 | 18 | 51 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE ITERATOR| | 9 | 18 | 51 (0)| 00:00:01 | 1 | 4 |
|* 2 | TABLE ACCESS FULL | test | 9 | 18 | 51 (0)| 00:00:01 | 1 | 4 |
-------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ID"<=32 AND "ID">=1)
SQL> remark 掃描全部分割槽
SQL> select * from test ;
1
2
11
12
21
22
31
32
41
42
執行計劃
----------------------------------------------------------
Plan hash value: 1271614465
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10 | 20 | 64 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE ALL| | 10 | 20 | 64 (0)| 00:00:01 | 1 | 5 |
| 2 | TABLE ACCESS FULL | test | 10 | 20 | 64 (0)| 00:00:01 | 1 | 5 |
--------------------------------------------------------------------------------------------
SQL> spool off;
出處:http://www.itpub.net/thread-1854955-1-1.html
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1562686/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 分割槽 執行計劃
- 分割槽表與堆表執行計劃的不同
- MySQL 5.5 檢視分割槽表的執行計劃MySql
- 分割槽表中的區域性分割槽索引及全域性索引與執行計劃索引
- 分割槽索引(Partition Index)與SQL執行計劃(中)索引IndexSQL
- 分割槽索引(Partition Index)與SQL執行計劃(下)索引IndexSQL
- 分割槽索引(Partition Index)與SQL執行計劃(上)索引IndexSQL
- oracle分割槽表和分割槽表exchangeOracle
- 對刪除分割槽的分割槽表執行TSPITR
- 對分割槽表的部分分割槽執行TSPITR
- Oracle分割槽表及分割槽索引Oracle索引
- oracle分割槽表和非分割槽表exchangeOracle
- Oracle 表分割槽Oracle
- oracle分割槽表Oracle
- oracle表分割槽Oracle
- Oracle 分割槽表Oracle
- oracle 分割槽表進行shrink操作Oracle
- 簡單ORACLE分割槽表、分割槽索引Oracle索引
- (轉)ORACLE 分割槽表的設計Oracle
- Oracle 建立分割槽表Oracle
- ORACLE分割槽表管理Oracle
- Oracle訪問表的執行計劃Oracle
- [oracle] expdp 匯出分割槽表的分割槽Oracle
- Oracle分割槽表增加分割槽報錯“ORA-14760:不允許對間隔分割槽物件執行 ADD PARTITION”Oracle物件
- Oracle分割槽表基礎運維-06分割槽表索引Oracle運維索引
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- 深入學習Oracle分割槽表及分割槽索引Oracle索引
- 全面認識oracle分割槽表及分割槽索引Oracle索引
- Oracle分割槽表基礎運維-07增加分割槽(3列表分割槽)Oracle運維
- ORACLE分割槽表梳理系列Oracle
- Oracle分割槽表遷移Oracle
- oracle 分割槽表詳解Oracle
- Oracle分割槽表介紹Oracle
- oracle表分割槽詳解Oracle
- oracle分割槽表詳解Oracle
- Oracle 分割槽表的建立Oracle
- Oracle分割槽表(Partition Table)Oracle
- oracle 分割槽表總結Oracle