Oracle分区表执行计划(2)

--KEY,表示执行时才知道哪个分区
SQL> explain plan for select * from t1 where created>=sysdate-1;
-------------------------------------------------------------------------------------------------
| Id  | Operation                | Name | Rows  | Bytes | Cost (%CPU)| Time    | Pstart| Pstop |
-------------------------------------------------------------------------------------------------
|  0 | SELECT STATEMENT        |      |  947 |  163K|    33  (16)| 00:00:01 |      |      |
|  1 |  PARTITION RANGE ITERATOR|      |  947 |  163K|    33  (16)| 00:00:01 |  KEY |    13 |
|*  2 |  TABLE ACCESS FULL      | T1  |  947 |  163K|    33  (16)| 00:00:01 |  KEY |    13 |
-------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - filter("CREATED">=SYSDATE@!-1)

SQL> variable x varchar2;
SQL> explain plan for select * from t1 where created>=to_date(:x,'yyyymmdd');
-------------------------------------------------------------------------------------------------
| Id  | Operation                | Name | Rows  | Bytes | Cost (%CPU)| Time    | Pstart| Pstop |
-------------------------------------------------------------------------------------------------
|  0 | SELECT STATEMENT        |      |  2099 |  362K|  107  (2)| 00:00:02 |      |      |
|  1 |  PARTITION RANGE ITERATOR|      |  2099 |  362K|  107  (2)| 00:00:02 |  KEY |    13 |
|*  2 |  TABLE ACCESS FULL      | T1  |  2099 |  362K|  107  (2)| 00:00:02 |  KEY |    13 |
-------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - filter("CREATED">=TO_DATE(:X,'yyyymmdd'))

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9b50bd356d5f4fcbc8fe7a41f435390b.html