2 messages in com.mysql.lists.javaRe: Display part of the Result Set
FromSent OnAttachments
Keith Wong17 Jan 2000 16:33 
Cris Perdue17 Jan 2000 22:11 
Subject:Re: Display part of the Result Set
From:Cris Perdue (cr@perdues.com)
Date:01/17/2000 10:11:54 PM
List:com.mysql.lists.java

I am using the mysql and java to bulid the online store. In the search engine part, I get into the trouble. I am trying to do is i want to display the first 20 results in 1000 results hits. If i want to read the 8th 20 results or read back to the 1st 20 result after the 10th 20 result displayed, that I don't need to do the re-query again. I know the mysql is not support the view function, that is the one of the problems. Do you have any good ideal?

You could cache the results of the search, using the query parameters or even the complete SQL query as the key to lookup the cached results.

But in many cases MySQL is fast enough that you are better off to use the MySQL "limit <n>" query syntax to reduce the amount of data returned, and simply redo the query every time.

The JDBC driver must read *all* the data returned from your query, like 1000 records. MySQL is very fast and most users in many applications only read the first 20,40, or maybe 60 results, so you can save a lot of time by not transfering all 1000 records from the database. So you might want to start simple, using "limit".