Home » RDBMS Server » Performance Tuning » cost in explain plan
cost in explain plan [message #305390] Mon, 10 March 2008 10:51 Go to next message
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 #305395 is a reply to message #305390] Mon, 10 March 2008 11:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Database Performance Tuning Guide
Chapter 19 Using EXPLAIN PLAN

Regards
Michel
Re: cost in explain plan [message #305397 is a reply to message #305390] Mon, 10 March 2008 11:05 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Cost is an estimation, based on the available statistics.
In CBO we Trust.
Re: cost in explain plan [message #305472 is a reply to message #305397] Mon, 10 March 2008 20:56 Go to previous message
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
Previous Topic: AWR Report or ADDM Report?
Next Topic: IMPROVE PERFORMANCE WHEN INSERT RECORDS
Goto Forum:
  


Current Time: Sat Nov 23 01:48:12 CST 2024