Subject Re: [firebird-support] Re: The First to select
Author Woody
From: "Ann W. Harrison" <aharrison@...>
>
> A slightly more conventional version would be
>
> 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.

Ann,

In what way is

select 1
from rdb$database
where exists (select 1
from <table>
where <field> is NULL)

any better than just

select 1 from <table> where <field> is NULL

?

Does selecting 1 from rdb$database cause the fb engine to shortcut the
select as soon as it finds 1 record or does the scan happen in the same way
for both?

Woody (TMW)