> Doesn't sqlite "know" the number of rows in each table without 
> explicitly counting them? Thanks for any help Buzz 

No it doesn't know that. One thing you could try using is triggers.
eg. Set a trigger to increment a value in some other table when a
row is inserted, and decrement the value when a row is deleted.
Then instead of your SELECT count(*)... statement you can just
pull a single row from the database. Probably only have to read one 
page, as opposed to reading every page in the table.

Naturally, you'll pay a price for this. Basically you will be reading
and writing an extra database page every time you do an insert or
a delete. This might be about 50-100% overhead on each insert/delete.

Dan.

Reply via email to