11 messages in com.mysql.lists.javaRE: Handling Huge Result Sets
FromSent OnAttachments
"Schäfer, Peter"29 Jan 2003 23:40 
Mark Matthews30 Jan 2003 05:32 
"Schäfer, Peter"30 Jan 2003 06:17 
Mark Matthews30 Jan 2003 13:33 
"Schäfer, Peter"03 Feb 2003 00:55 
Shankar Unni03 Feb 2003 10:50 
Udkik04 Feb 2003 01:31 
Jeremy Zawodny04 Feb 2003 09:33 
Udkik04 Feb 2003 13:42 
raf...@dcit.com06 Feb 2003 12:51 
Mark Matthews08 Feb 2003 06:34 
Subject:RE: Handling Huge Result Sets
From:Shankar Unni (shan@cotagesoft.com)
Date:02/03/2003 10:50:50 AM
List:com.mysql.lists.java

Peter Schäfer wrote:

For example, is LIMIT 50000,1000 more expensive than LIMIT 1,1000 ?

The answer is probably "it depends". If it's a simple indexed query without sorts, probably not. I'm hoping that MySQL can skip over the first 50000 elements of an index *relatively* quickly.

If the query is very complex, again, the answer is "probably not", since it has to do a fair amount of work, including building up the entire result set, for either case.

There may be a class of queries for which the former is more expensive than the latter, however..

For the "complex query" case, you're really critically dependent on the efficiency of the query cache. If you have not made any modifications to the table between the runs (and other queries haven't pushed your query out of the cache), the query should be able to iterate over the cached query results, making the second and subsequent calls *much* faster.