[thelist] SQL-What is quicker?

Adrian Fischer adrian at logo-logic.com
Mon Nov 20 19:00:19 CST 2000


Hi Gang,

Scenario..Search on a criteria and then show 10 records per page.

What would be quicker...
Selecting all the records that meet the criteria and then only show 10 at a
time i.e select all then show records 0-9..select all again then show
records 10-19 etc (using an if ()).
or
select records that meet criteria but use LIMIT i.e select all that meet
LIMIT 0,10....then select again but show LIMIT 10,10...etc (the first number
being the offset and the second being the number of records to return).

I'm thinking that the second is quicker because it doesn't have to read the
whole table.  But is it less effective because it has to find the start and
end point each time? Or does it depend on the number of records in the
table?

Opinions/Comments.

Thanks

Adrian Fischer
DB Numpty








More information about the thelist mailing list