Subject | Re: [firebird-support] Re: The First to select |
---|---|
Author | Ann W. Harrison |
Post date | 2006-02-13T22:23:04Z |
Richard Wesley wrote:
select 1
from rdb$database
where exists (select 1
from <table>
where <field> is NULL)
Either is exactly a full table scan if the field is never null, but
less than that if the field can be null.
Regards,
Ann
>A slightly more conventional version would be
> I have just done something similar to check for NULLs without
> indexing (I may not have control over the database being queried):
>
> select first 1 <field> from <table> where <field> is NULL;
>
> Hopefully, this will just read records in the most convenient order
> until it hits one and then stop. Anyone know if this is any faster
> than a full table scan?
select 1
from rdb$database
where exists (select 1
from <table>
where <field> is NULL)
Either is exactly a full table scan if the field is never null, but
less than that if the field can be null.
Regards,
Ann