List:MySQL and Java« Previous MessageNext Message »
From:Cris Perdue Date:January 18 2000 6:12am
Subject:Re: Display part of the Result Set
View as plain text  
> 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".
--
Cris Perdue
Impact Online, Inc.
http://www.volunteermatch.org


Thread
Display part of the Result SetKeith Wong18 Jan
  • Re: Display part of the Result SetCris Perdue18 Jan