--- Mina R Waheeb <[EMAIL PROTECTED]> wrote:
> Do you mean the LIMIT in SQLite is not optimized? and the performance
> of selecting from table contains 1000 rows match the query condation
> equal selecting the same condation with limit 990,10?

Pretty much, yes, as it should be.

LIMIT is optimized correctly. It is not as simplistic as you think.
SQLite uses btrees internally to store row data and index data. 
There are no table row counts stored anywhere in the database.

If a user selects all rows in a 5 row table, say:

  select * from t;
  30
  2
  17
  90
  5

and then they go "select * from t limit 3 offset 2;" most would
scream bloody murder if the following rows were not returned:

  17
  90
  5

but in fact, because it is an unordered SELECT, any 3 rows could 
technically be returned. But there is an implicit ordering that the
SQLite and MySQL users have grown accustomed to seeing. (LIMIT is not
in the SQL standard). So even when no ORDER BY and no GROUP BY is used, 
you need to scan at least LIMIT+OFFSET rows anyway in order to get 
the result.

Look at select.c and use "EXPLAIN SELECT ..." and examine the VDBE 
instructions yourself for your queries and schema.


       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to