|
-
Apr 14th, 2008, 06:33 AM
#6
Re: Get both COUNT and LIMITed resultset
Ok - then I'm guessing the COUNT is needed so that the LIMIT can be determined for the final resultset. And it's probably not something as simply as 50% or 25% (which TOP 50 PERCENT is allowed in MS SQL at any rate).
Then I agree with what Si said - build a temp table. It can be just the primary key's of the rows to get so that the complex WHERE clause only occurs in the building of the temp table.
Then the LIMIT'd 2nd resultset comes FROM the primary key's of the temp table - which should make the second fetch much faster.
Last edited by szlamany; Apr 14th, 2008 at 06:37 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|