Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

STATISTICS IO: Scan Count vs Logical reads

$
0
0

Hello

I'm doing som performance research, I have a index with following priority: ClientId, Active, ProductId. Active is a bit field telling whether the Product is active or not, it can be inactive products than active, but always at least one active product.

When I'm executing

SELECT*FROM [table] WHERE ClientId = [id] AND ProductId IN(1,2,3,5,7,9,20)

I'm getting following result: Scan count 1, logical reads 490

 

When I'm leading SQL Server to the right paths by including the to possible values in Active by executing the following SQL:

SELECT*FROM [table] WHERE ClientId = [id] AND ProductId IN(1,2,3,5,7,9,20)AND Active IN(0,1)

I'm getting following results: Scan count 14, logical reads 123

 

With this information, which version would you say is fastest and why?

When I was running this query 1000 times with different ClientId I got a average time of 172 ms for the first query, and 155 ms for the second one. I have been told that scan count is very expensive... out of this example it seems that the cost of 1 scan count is like 20 logical reads?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>