Rob Sciuk <rob-fXH868kH56pWk0Htik3J/[EMAIL PROTECTED]> wrote:
On Mon, 30 Oct 2006, Igor Tandetnik wrote:
Date: Mon, 30 Oct 2006 11:21:15 -0500
From: Igor Tandetnik <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: SQLite <[EMAIL PROTECTED]>
Subject: [sqlite] Re: efficient way to figure out if a table is empty
Xavier Noria
<[EMAIL PROTECTED]>
wrote:
Not that is critical for my application, but just for curiosity
which is the recommended idiom to figure out whether a table has any
register?
select exists (select * from tablename);
Would it not make sense to use the limit on the subquery to reduce
overhead in the case where the table is populated?
select exists( select * from tablename limit 1 );
It's actually a pessimization - feel free to check with EXPLAIN. Your
query produces a slightly larger and more complicated program than my
query. Neither query actually retrieves a single record, both use Rewind
instruction to check whether a table is empty or not.
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------