[sqlite] Re: Performance problem for a simple select with range

2007-10-31 Thread Igor Tandetnik
Doug <[EMAIL PROTECTED]> wrote: I'm not an SQL guru by any means, so seeing this made a light go on. Does that mean it is a good idea in the general case to always add "limit 1" to a select that you know should only return 1 row? That probably can't hurt (if you are sure the query would only ev

[sqlite] Re: Performance problem for a simple select with range

2007-10-31 Thread Igor Tandetnik
Dani Va <[EMAIL PROTECTED]> wrote: First, thanks, your suggestion worked. To my surprise, it was enough to add "limit 1" to the original query. Try searching for a value that doesn't fall into any block - you'll likely find that the query takes a noticeable time to produce zero records. Pick

[sqlite] Re: Performance problem for a simple select with range

2007-10-29 Thread Igor Tandetnik
Dani Valevski <[EMAIL PROTECTED]> wrote: I think I have a performance problem for a simple select with range. My Tables: CREATE TABLE locations( locidINTEGER PRIMARY KEY, country TEXT, regionTEXT, cityTEXT, po

[sqlite] Re: Performance problem

2007-03-01 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: Stephen Toney <[EMAIL PROTECTED]> wrote: select count(*) from keyword a, keyword b where a.key=b.key and a.value='music' and b.value='history'; 4,318 records have value='music' and 27,058 have value='history'. The keys are 12-byte strings. That doesn't seem like an extr

[sqlite] Re: Performance problem

2007-03-01 Thread Igor Tandetnik
Stephen Toney wrote: select count(*) from keyword a, keyword b where a.key=b.key and a.value='music' and b.value='history'; 0|0|TABLE keyword AS a WITH INDEX value 1|1|TABLE keyword AS b WITH INDEX value 4,318 records have value='music' and 27,058 have value='history'. Try running ANALYZE st