Analyzing index increase Query cost
Following is my experience.
SQL> explain plan for
2 update prtcpnt
3 set f9= 1
4 WHERE f3 = :b1
5 AND f4 = :b2
6 AND f2 != :b3
7 /
Explained.
SQL> @showplan
SQL> set echo off
Query Plan COST
-------------------------------------------------------------------------------- ----------
UPDATE STATEMENT [CHOOSE] Cost = 27 27
UPDATE PRTCPNT
INDEX RANGE SCAN PR_TEST 2
SQL>
After that I am analyzing Index, and then Plan shows cost more. What is the reason.
SQL> analyze index pr_test compute statistics;
Index analyzed.
SQL> @expl
SQL> truncate table plan_table;
Table truncated.
SQL> explain plan for
2 update prtcpnt
3 set f9= 1
4 WHERE f3 = :b1
5 AND f4 = :b2
6 AND f2 != :b3
7 /
Explained.
SQL> @showplan
SQL> set echo off
Query Plan COST
-------------------------------------------------------------------------------- ----------
UPDATE STATEMENT [CHOOSE] Cost = 445 445
UPDATE PRTCPNT
INDEX RANGE SCAN PR_TEST [ANALYZED] 56
SQL>
The table contains more than 500000 records.
Re: Analyzing index increase Query cost
Quote:
Originally posted by Dilippatel
After that I am analyzing Index, and then Plan shows cost more. What is the reason.
Try rebuilding the index and then analyze and then try getting execution plan.
Re: Re: Analyzing index increase Query cost
Quote:
Originally posted by nagarjuna
Try rebuilding the index and then analyze and then try getting execution plan.
What do you expect that to do?
Re: Re: Analyzing index increase Query cost
Quote:
Originally posted by nagarjuna
Try rebuilding the index and then analyze and then try getting execution plan.
Why are you so inclined to rebuild index, when most of the times its not required or may even cause problems.
Abhay.