SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Query with high lob logical reads / read-ahead reads


Query with high lob logical reads / read-ahead reads

Author
Message
James Hollands
James Hollands
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 387
Hi

I have a table with a column of image data type. Our application fires queries at this table, retrieving the data in this column only. The queries are efficient, using the clustered index in the WHERE clause. The table contains approx 6 million rows.

With SET STATISTICS IO ON and SET STATISTICS TIME ON, I am seeing some varying performance depending on the fileID specified in the WHERE clause. The execution times vary, lob logical reads vary, and lob read-ahead reads vary. Although logical reads remain consistent.

For example -

--Query 1.)
SELECT fileData FROM Files WHERE fileId = 6491281;

Table 'Files'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 4876, lob physical reads 0, lob read-ahead reads 2082.

(1 row(s) affected)

SQL Server Execution Times:
CPU time = 32 ms, elapsed time = 1453 ms.


--Query 2.)
SELECT fileData FROM Files WHERE fileId = 6491868;

Table 'Files'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 3, lob physical reads 0, lob read-ahead reads 0.

(1 row(s) affected)

SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 1 ms.

Has anyone ever seen this before or have any ideas why this might be?

Would be really interested to know

Thanks
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41762 Visits: 14413
Can you correlate the size of the image you're retrieving in query 1 to the number of lob reads, and the same for query 2?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
James Hollands
James Hollands
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 387
Ok, so it looks like the size of the image being returned could be the issue.

Looking into it, query 1 (with high lob logical reads) is actually retrieving a 6MB .mp4 file. Whereas Query 2 is getting a 1KB .xsl file..

So the larger the physical file, the more image pages are read.

Makes sense!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search