Re: [sqlite] Quickest way to get an answer

2011-11-11 Thread Pavel Ivanov
>  select count(status) from mytable where status=0; >  select count(status) from mytable where status=0 limit 1; These two are identical because query always return one row thus making "limit 1" a no-op. >  select status from mytable where status=0 limit 1; This one will have the best

Re: [sqlite] Quickest way to get an answer

2011-11-11 Thread Simon Slavin
On 11 Nov 2011, at 7:27pm, Tim Streater wrote: > select count(status) from mytable where status=0; > select count(status) from mytable where status=0 limit 1; > select status from mytable where status=0 limit 1; > > When doing this a number of times I see some seconds of CPU being taken; I

[sqlite] Quickest way to get an answer

2011-11-11 Thread Tim Streater
My db has a column called "status". This can take one of 7 or so integer values from 0 to 7 or so. There are times when I need a quick answer to this question: are there any rows in the db for which status has value 0. I don't need to know how many, just whether there are any or not. What's the