My Oracle Support Banner

Subpartition Pruning With More Than One Constant Value in the IN List Predicate (Doc ID 1938904.1)

Last updated on AUGUST 04, 2018

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.3 to 12.1.0.2 [Release 11.2 to 12.1]
Information in this document applies to any platform.

Symptoms

Subpartition Pruning is not happening with Local Index Subpartition when more than one constant value is there in the IN list predicate.
The difference in execution plans is unexpected as both values, 1 and 2 reference the same subpartition, and index subpartition is usable.

a)select * from sp_testcase spt where subpartition_key in(1,2)  and partition_key = 1 and indexed_value = 102;

---------------------------------------------+-----------------------------------+---------------+
| Id  | Operation               | Name       | Rows  | Bytes | Cost  | Time      | Pstart| Pstop |
---------------------------------------------+-----------------------------------+---------------+
| 0   | SELECT STATEMENT        |            |       |       |    94 |           |       |       |
| 1   |  PARTITION LIST SINGLE  |            |     1 |    10 |    94 |  00:00:01 | 1     | 1     |
| 2   |   PARTITION LIST INLIST |            |     1 |    10 |    94 |  00:00:01 | KEY(INLIST)| KEY(INLIST)|
| 3   |    TABLE ACCESS FULL    | SP_TESTCASE|     1 |    10 |    94 |  00:00:01 | KEY(INLIST)| KEY(INLIST)|
---------------------------------------------+-----------------------------------+---------------+

Predicate Information:
----------------------
3 - filter("INDEXED_VALUE"=102)

b)select * from sp_testcase spt where subpartition_key in(2)  and partition_key = 1 and indexed_value = 102;

--------------------------------------------------------------+-----------------------------------+---------------+
| Id  | Operation                            | Name           | Rows  | Bytes | Cost  | Time      | Pstart| Pstop |
--------------------------------------------------------------+-----------------------------------+---------------+
| 0   | SELECT STATEMENT                     |                |       |       |     2 |           |       |       |
| 1   |  PARTITION LIST SINGLE               |                |     1 |    10 |     2 |  00:00:01 | 1     | 1     |
| 2   |   PARTITION LIST SINGLE              |                |     1 |    10 |     2 |  00:00:01 | KEY   | KEY   |
| 3   |    TABLE ACCESS BY LOCAL INDEX ROWID | SP_TESTCASE    |     1 |    10 |     2 |  00:00:01 | 1     | 1     |
| 4   |     INDEX RANGE SCAN                 | SP_TESTCASE_IX1|     1 |       |     1 |  00:00:01 | 1     | 1     |
--------------------------------------------------------------+-----------------------------------+---------------+
Predicate Information:
----------------------
3 - filter("SUBPARTITION_KEY"=2)
4 - access("INDEXED_VALUE"=102)

This difference in execution plans is unexpected as both values, 1 and 2 reference the same subpartition, and index subpartition is usable:

SQL> select INDEX_OWNER,INDEX_NAME,PARTITION_NAME,SUBPARTITION_NAME,HIGH_VALUE,STATUS,BLEVEL,LEAF_BLOCKS,DISTINCT_KEYS,AVG_LEAF_BLOCKS_PER_KEY,CLUSTERING_FACTOR,NUM_ROWS from dba_ind_subpartitions where index_name='SP_TESTCASE_IX1';

INDEX_OWNER                    INDEX_NAME       PARTITION_NAME   SUBPARTITION_NAM HIGH_VAL STATUS       BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY CLUSTERING_FACTOR   NUM_ROWS
------------------------------ ---------------- ---------------- ---------------- -------- -------- ---------- ----------- ------------- ----------------------- ----------------- ----------
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P1   SP_TESTCASE_SP1  1, 2     USABLE            1           6          2500                       1                 6       2500
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P1   SP_TESTCASE_SP2  3        UNUSABLE          0           0             0                       0                 0          0
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P1   SP_TESTCASE_SP3  default  UNUSABLE          0           0             0                       0                 0          0
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P2   SP_TESTCASE_SP4  1, 2     USABLE            1           6          2500                       1                 6       2500
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P2   SP_TESTCASE_SP5  3        UNUSABLE          0           0             0                       0                 0          0
SPTEST                         SP_TESTCASE_IX1  SP_TESTCASE_P2   SP_TESTCASE_SP6  default  UNUSABLE          0           0             0                       0                 0          0

6 rows selected.



Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.