Monday, August 30, 2010

What IS the cost of a query and what does it mean?

The formula for the cost (using the CPU Costing Model) of a query is:

Cost = (
#SRds * sreadtime
+ #MRds * mreadtime
+ #CPUCycles / cpuspeed
) / sreadtime

where:
#SRds = number of single block reads
#MRds = number of multi block reads
#CPUCycles = number of CPU Cycles

sreadtim = single block read time
mreadtime = multi block read time
cpuspeed = Standard 'Oracle' CPU cycles per second

The translation of this formula is:

The cost is the time spent on single block reads, plus the time spent on multiblock reads, plus the CPU time required, all divided by the time is takes to do a single block read.

This means that the cost of a query is the PREDICTED EXECUTION TIME, counted in number of single block read times and is effectively the unit of measure of the cost.

No comments:

Post a Comment