Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query with high lob logical reads / read-ahead reads Expand / Collapse
Author
Message
Posted Monday, April 08, 2013 8:31 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 4:01 AM
Points: 52, Visits: 370
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

Post #1439870
Posted Monday, April 08, 2013 9:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 9:25 AM
Points: 7,070, Visits: 12,523
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

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1439906
Posted Monday, April 08, 2013 10:10 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 4:01 AM
Points: 52, Visits: 370
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!
Post #1439928
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse