FIX: ORDER BY DESC Queries May Cause High Logical ReadsID: Q140606
|
BUG# NT: 12057 (6.00)
15670 (6.50)
A SELECT query containing an ORDER BY DESC clause can sometimes cause a high number of logical reads in SQL Server 6.0.
This can occur if the optimizer chooses to process the query by using an
index on the ordered column and the WHERE clause of the query includes a
range search such as the following:
SELECT *
FROM inv_table
WHERE inv_no BETWEEN 100 AND 500
ORDER BY inv_no DESC
Restructure the query to use an intermediate temporary table such as
the following:
SELECT * INTO #tmp_inv
FROM inv_table
WHERE inv_no BETWEEN 100 AND 500
SELECT *
FROM #tmp_inv
ORDER BY inv_no DESC
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.
Additional query words: sql6 performance
Keywords : kbprg SSrvProg SSrvTran_SQL kbbug6.50 kbbug6.00 kbfix6.50.sp2
Version : 6.0 6.5
Platform : NT WINDOWS
Issue type :
Last Reviewed: March 24, 1999