I need to select batches of N rows from a large table.
I know of two ways of doing this:
SET ROWCOUNT
SET ROWCOUNT #### SELECT something FROM table WHERE clauses SET ROWCOUNT 0 -- rowcount is only needed for the one query above.
TOP
SELECT TOP ### something FROM table WHERE clauses
Is there any performance difference (or any other reason to pick one over another) between the two solutions?
Notes:
- If it matters, Sybase ASE is version 15.
- The query is a single
SELECT
statement. The limit will not apply to any other statements (so usual reasons to pick rowcount over top don't apply). - The order of the rows does not matter
Research done:
- This SO Q&A has accepted answer which claims no difference without any supporting references; and another answer that shows a possible un-measured difference for MS SQL server (which I'm not sure applies to Sybase as the reference is from Microsoft).