Subject | Re: [firebird-support] Re: The First to select |
---|---|
Author | Alexandre Benson Smith |
Post date | 2006-02-13T22:41:25Z |
Woody wrote:
No, the EXISTS stop the query as soon it finds one that match the search
criteria.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
> From: "Ann W. Harrison" <aharrison@...>Woody,
>
>> 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)
>
>
>
No, the EXISTS stop the query as soon it finds one that match the search
criteria.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br