Different values come from SET STATISTICS IO ON and sys.dm_exec_query_stats

  • This is my first message here so firstly i would liek to say 'Hello'.

    I have a problem i hope that you will help me because i am stuck.

    1. At the beginning i cleaned the buffer(data cache) executing DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS

    2. Then i run SET STATISTICS IO ON to have a statistics after query execution.

    3. I run select * from and i've got following message:

    10000 row (s) affected)

    Table 'person'. Scan count 1, logical reads 318, physical reads 0, read -

    ahead reads 332, lob logical reads 0, lob physical reads 0, lob read -

    ahead reads 0

    In this point i have a small less important question. Why i have physical reads 0 if this was a first execution of query?? What's more i cleaned buffers so i expected that i will be have many physical reads! This is what i dont understand at all.

    4. I went further and read in the internet that i can also look at the costs of executed query using following query: select * from sys.dm_exec_query_stats so i executed this query, found a row which stored costs of "select * from " and compare result with the result from point3. What's occured.

    In the table sys.dm_exec_query_stats i found following data [column - value]:

    last_physical_reads - 13 ( in point 3 i have 0)

    last_logical_reads - 322 (in point 3 i have 318 )

    So the most important question of this topic is why i have these divergences and which data are correct 🙂

    I hope you understand me correctly and sorry for my mistakes i don't speak english very well 🙂

    Regards!

  • Guys don't leave me i am stuck i really need your help 🙂 i was trying to find an answer in the net but withour results 🙁

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply