I/O cost of single sql statement
140129Apr 30 2003 — edited Apr 30 2003Hi there,
I have a problem when measuring the I/O cost of single sql statements. I'd like to know the I/O cost of a sql statement where there is no any buffer or cache. What I did is to use the sum of 'buffer_gets' and 'disk_reads' of that sql statements from 'v$sqlarea' as the I/O cost. However, I found the 'buffer_gets' of similar sql statements varies a lot. For example,
select * from test_table where id=id_number;
The 'id' is the primary key of the table and has a index on it. Table test_table has about 10,000 records. When I run this sql with different id_number (random), the buffer_gets of the query vary from 10 to 1,000, while the disk_reads is 0 most of the time.
So what is the real I/O cost of this query? Is 'buffer_gets' or 'disk_reads' includes the cost of reading index? Is there any other way to get the I/O cost (without any buffer or cache)?
Thank you,