Below tests demonstrated how wrong the cardinaltiy estimeated by the bitmap plan could be.
- in the bitmap plan, the number of rows estimated is 578K
SQL> select * from BOD_OTHR_SERIAL_ACTIVITY_I8400 I8400 2 where 3 (I8400.DVTQ_ACCT_NUM = 'A145779917' OR ( 4 I8400.UJTJPM_CUSTOMER_ID = '' AND I8400.UJTJPM_ACCOUNT_ID = '' 5 )) 6 ; Execution Plan ---------------------------------------------------------- Plan hash value: 972526864 ------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 578K| 170M| 161K (11)| 00:05:17 | | 1 | TABLE ACCESS BY INDEX ROWID | BOD_OTHR_SERIAL_ACTIVITY_I8400 | 578K| 170M| 161K (11)| 00:05:17 | | 2 | BITMAP CONVERSION TO ROWIDS | | | | | | | 3 | BITMAP OR | | | | | | | 4 | BITMAP CONVERSION FROM ROWIDS| | | | | | |* 5 | INDEX RANGE SCAN | IX_I8400_04 | | | 1 (0)| 00:00:01 | | 6 | BITMAP CONVERSION FROM ROWIDS| | | | | | |* 7 | INDEX RANGE SCAN | IX_I8400_07 | | | 3 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 5 - access("I8400"."UJTJPM_CUSTOMER_ID"='' AND "I8400"."UJTJPM_ACCOUNT_ID"='') 7 - access("I8400"."DVTQ_ACCT_NUM"='A145779917')
- -- disable the bitmap plan
SQL> alter session set "_b_tree_bitmap_plans"=false; Session altered.
- -- Now the estimated rows is 2
SQL> select * from BOD_OTHR_SERIAL_ACTIVITY_I8400 I8400 2 where 3 (I8400.DVTQ_ACCT_NUM = 'A145779917' OR ( 4 I8400.UJTJPM_CUSTOMER_ID = '' AND I8400.UJTJPM_ACCOUNT_ID = '' 5 )) 6 ; Execution Plan ---------------------------------------------------------- Plan hash value: 7978316 --------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 2 | 618 | 9 (0)| 00:00:01 | | 1 | CONCATENATION | | | | | | | 2 | TABLE ACCESS BY INDEX ROWID| BOD_OTHR_SERIAL_ACTIVITY_I8400 | 1 | 309 | 6 (0)| 00:00:01 | |* 3 | INDEX RANGE SCAN | IX_I8400_07 | 1 | | 4 (25)| 00:00:01 | |* 4 | TABLE ACCESS BY INDEX ROWID| BOD_OTHR_SERIAL_ACTIVITY_I8400 | 1 | 309 | 3 (0)| 00:00:01 | |* 5 | INDEX RANGE SCAN | IX_I8400_04 | 1 | | 2 (50)| 00:00:01 | --------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("I8400"."DVTQ_ACCT_NUM"='A145779917') 4 - filter(LNNVL("I8400"."DVTQ_ACCT_NUM"='A145779917')) 5 - access("I8400"."UJTJPM_CUSTOMER_ID"='' AND "I8400"."UJTJPM_ACCOUNT_ID"='')
- the acutall number of row is 1:
SQL> select count(*) from BOD_OTHR_SERIAL_ACTIVITY_I8400 I8400 2 where 3 (I8400.CUST_ACCT_NUM = 'A145779917' OR ( 4 I8400.UJTJPM_CUSTOMER_ID = '' AND I8400.UJTJPM_ACCOUNT_ID = '' 5 )) 6 ; COUNT(*) ---------- 1 1 row selected.
No comments:
Post a Comment