Hi,
We had failed over our primary Oracle DB to our standby. Both servers are identical. Now i have noticed that one update statement was executing very slow on the new server. When comparing the execution plans for the same statement I've noticed that one index was not used on the new server and it was dong fts. I did gather stats for the table and the index that was not used, but to no avail. Then I hint the index and got execution plan that did not use fts but the cost difference was high when using the same index. Bellow are the plans and the statement:
on the old server:
UPDATE STATEMENT ALL_ROWS
Cost: 50,402 Bytes: 10,090,430 Cardinality: 107,345
Partition #: 0
8 UPDATE PMTPROD01.PAYMP_LIABILITY_INFO
Cost: 0 Bytes: 0 Cardinality: 0
Partition #: 0
7 MERGE JOIN ANTI NA
Cost: 50,402 Bytes: 10,090,430 Cardinality: 107,345
Partition #: 0
3 SORT JOIN
Cost: 50,201 Bytes: 5,581,940 Cardinality: 107,345
Partition #: 0
2 TABLE ACCESS BY INDEX ROWID PMTPROD01.PAYMP_LIABILITY_INFO [Analyzed]
Cost: 48,815 Bytes: 5,581,940 Cardinality: 107,345
Partition #: 0
1 INDEX RANGE SCAN PMTPROD01.PAYMP_LBI_CLIENT_FK_I [Analyzed]
Cost: 1,549 Bytes: 0 Cardinality: 214,690
Partition #: 0
6 SORT UNIQUE
Cost: 201 Bytes: 84 Cardinality: 2
Partition #: 0
5 TABLE ACCESS BY INDEX ROWID PMTPROD01.PAYMP_LIABILITY_INFO [Analyzed]
Cost: 200 Bytes: 84 Cardinality: 2
Partition #: 0
4 INDEX RANGE SCAN PMTPROD01.PAYMP_BATCHID_FK_I [Analyzed]
Cost: 15 Bytes: 0 Cardinality: 699
Partition #: 0
new server:
Plan
9 UPDATE STATEMENT ALL_ROWS
Cost: 2,047,856 Bytes: 1,187,129,806 Cardinality: 6,862,022
Partition #: 0
8 UPDATE PMTPROD01.PAYMP_LIABILITY_INFO
Cost: 0 Bytes: 0 Cardinality: 0
Partition #: 0
7 MERGE JOIN ANTI NA
Cost: 2,047,856 Bytes: 1,187,129,806 Cardinality: 6,862,022
Partition #: 0
3 SORT JOIN
Cost: 2,047,708 Bytes: 631,306,024 Cardinality: 6,862,022
Partition #: 0
2 TABLE ACCESS BY INDEX ROWID PMTPROD01.PAYMP_LIABILITY_INFO [Analyzed]
Cost: 1,902,202 Bytes: 631,306,024 Cardinality: 6,862,022
Partition #: 0
1 INDEX RANGE SCAN PMTPROD01.PAYMP_LBI_CLIENT_FK_I [Analyzed]
Cost: 60,160 Bytes: 0 Cardinality: 8,037,047
Partition #: 0
6 SORT UNIQUE
Cost: 148 Bytes: 7,452 Cardinality: 92
Partition #: 0
5 TABLE ACCESS BY INDEX ROWID PMTPROD01.PAYMP_LIABILITY_INFO [Analyzed]
Cost: 147 Bytes: 7,452 Cardinality: 92
Partition #: 0
4 INDEX RANGE SCAN PMTPROD01.PAYMP_BATCHID_FK_I [Analyzed]
Cost: 12 Bytes: 0 Cardinality: 506
Partition #: 0
statement:
update /*+ index (li PAYMP_LBI_CLIENT_FK_I) */
pmtprod01.paymp_liability_info li
set li.active_flag = 'N',
li.modified_by = 'a',
li.modified_on = sysdate
where li.client_code = '11111111111'
and li.active_flag = 'Y'
and (li.account_number,
nvl (li.invoice_number, 'Y'),
li.cx_segment_type_code,
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token1, 'Y') end),
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token2, 'Y') end),
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token3, 'Y') end)
) not in (
select li.account_number,
nvl (li.invoice_number, 'Y'),
li.cx_segment_type_code,
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token1, 'Y') end),
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token2, 'Y') end),
(case when 'N' = 'N' then 'Y' else nvl(li.auth_token3, 'Y') end)
from pmtprod01.paymp_liability_info li
where li.client_code = '11111111111'
and li.batch_id = 4631161
and li.active_flag = 'Y'
);
Not sure why the difference?
Any help is greatly appreciated.
Thanks,
Zare