MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cost of a query.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Fri May 04, 2007 11:18 am    Post subject: Cost of a query. Reply with quote

Hi All,

I need to know how the cost of a query gets calculated.

I ran an explain on a query and got the cost as X. the number of rows on the table was say 10000. Now I changed the query and again ran an explain on this query . The cost was X-2 say...( with the same num of rows).

Now I deleted 1000 rows from the table and ran an explain on the same 2 queries. The cost ratio was Y/Y-4

Now my question is shud the ratio

X/X-2 = Y/Y-4

I am really confused here. doesn't the cost depend on number of rows ?

any pointer will be of great help!

I did read the :

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/6.4.8?DT=20010710165542#HDRL344STB

But ther is no mention of how the cost gets calculated.

-Mt
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri May 04, 2007 4:24 pm    Post subject: Reply with quote

Smoke and mirrors....There is an "entity" that tries to predict the best way to access the data required for a select. It uses various system tables and other arcane information. It doesn't always pick the best, sometimes it has to be "duped" to chose a construct that is actually better.
The cost reflected by an explain can only be taken as a measure of what that "entity" thinks is the best way.
In short, sometimes re-arranging the conditions of a WHERE clause can change things, sometimes modifying a system table entry to increase the number of rows can influence the "entity" to pick or avoid a particular access path, sometimes reducing the number of rows can sway its decision....
Like I started with smoke and mirrors.... Or, that's why good DBAs get paid so much.....
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Sun May 06, 2007 4:53 am    Post subject: Reply with quote

You could speak to your capacity and performance group. They are the ones that usually look at how much resource is consumed by what, and may be able to apply a cost to it.

Many years ago I was into all of that, it's conplicated, and you would need something like MXG to do most of the work for you.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group