cost in explain plan [message #305390] |
Mon, 10 March 2008 10:51 |
dcaroli
Messages: 1 Registered: March 2008 Location: Bergamo
|
Junior Member |
|
|
Hello,
a simple question: does the cost in explain plan is enough to estimate the validity of a query, i.e. if a statement has minor costs is better?
Thank you
|
|
|
|
|
Re: cost in explain plan [message #305472 is a reply to message #305397] |
Mon, 10 March 2008 20:56 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
No, COST is not a measure of "how good" a SQL is.
At best, it is a measure of how good Oracle's CBO thinks it is.
But this is not even always true. All you can say about the COST, is that if there are two or more possible execution paths that CBO evaluates for the same SQL, it will choose the lowest COST.
Will the one with the lowest cost be the fastest? Who knows?
Will two different SQLs with the same cost run in the same amount of time? Probably not.
If a plan has a low cost, should we trust that it is the best? Or even adequate? Absolutely not.
Ross Leishman
|
|
|