Thaks for the suggestions! I'm going to try to do the query without the LIMIT keyword, and then only use the rows I need. I'm not sure if you can get a "pointer" and then only fetch the rows you need in TCL, but I'll see if that is possible.
The program I'm writing must be able to run on rather old machines, so in this case speed is important. Hovewer I do agree that SQLite is a very fast database :) Johan Puneet Kishor wrote: >Don't know about Tcl, but make sure that you don't fetch all the >records (analogy: fetchall... methods in Perl DBI), but fetch just a >pointer to the cursor (fetchrow... methods), and then step through the >cursor. If you fetch all the records then the whole point is defeated. > >An alternative method is to define a separate table that keeps the >COUNT of the rows, and define a trigger that keeps that COUNT updated >every time you DELETE/INSERT/UPDATE on the main table. > >All depends on what you mean by "database is very large." For most >"large" SQLite still should be very fast, but if its largeness is >indeed contributing to a slowdown then the above alternatives should >work.