At 1:33 PM +0100 3/20/04, Shi Elektronische Medien GmbH, Peter Spiske wrote:
the following simple query is very slow:
  SELECT title FROM t1 WHERE ipnode='VZ' ORDER BY author;
The database is about 250 MB in size and the table the query is run against
has 12 cols and 120,000 rows.
Every col has an index.
The above query returns about 80% of the records.
As soon as the ORDER BY statement is left away, the query ist fast.

Whether or not indexes are used, sorting tends to be a very labour intensive operation and slows things down considerably.


You can try to isolate your slowdown like this:

1. Run your existing select and time it.

2. Take the order-by off your select and run it.

3. Make your existing select, with order-by, into a subselect (in "from" clause) of a larger select that does something trivial such as returning a count of rows from the inner select. You would have to be careful with your choice, though, to make sure that SQLite doesn't optimize anything away by your choice, as you want all the work for the inner select to do all the same work. The point is that the outer select returns almost no data. Then network speed is basically taken out of the equation and all the time is basically just the select execute and not the select fetch.

-- Darren Duncan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to