>> I was using count(*) just to detect the presence of any record  
>> meeting given condition. Is it possible to make
>> it fast _not_ using count(*)? I need just a "boolean result" of 1/0  
>> (yes, there is at least one / there aren't any).
>>
> Add      limit 1      to the query, so that it stops after finding the
> first match.

Actually, IIRC, "limit" only operates on the rows after a full table  
scan, so doesn't help.

What you need instead is:

select exists (select 1 from MyTable where condition)

which will return a boolean result, and stop scanning the table after  
the first match is found.

Tom
BareFeet

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to