Indexs are not paert of the equation at this point.....
If I have a query:
Will the fact that the number of search results that are being returned speed up the query given that because of the order by clause all possible results are pulled and sorted initialy before the ROWCOUNT limit is applied?Code:@Param... 1-20, @Page int, @NumberOfResults int, @MaxSearchResults int AS SET ROWCOUNT @MaxSearchResults DECLARE @Results TABLE ( CountID int IDENTITY NOT NULL, tblAID int, tblBID int ) INSERT INTO @Results (tblAID, tblBID) SELECT tblA.ID, tblB.ID FROM tblA INNER JOIN tbl ON tblA.BID = tblB.ID WHERE @Param...1-20 ORDER BY tblA.SomeColumn, tblB.SomeColumn SELECT tblA.*, tbl.* FROM @Results AS tblRet WHERE --page index is 1 based tblRet.CountID > @NumberOfResults * (@PageNumber - 1) AND tblRet.CountID <= @NumberOfResults * (@PageNumber) SET ROWCOUNT 0
Also won't setting this limit cause some results to never be avaliable?




Reply With Quote