Subject Re: Exists versus select first
Author csswa

AFAIK, 'if exists' is the most streamlined way to check on a record
configuration in a table. It doesn't need to allocate any variable
space; it just looks and returns true or false.

What I'd like to know: is it any quicker to use rdb$db_key as the
SELECTed field instead of * or another individual field ?? Claudio
has shown how rdb$db_key can be used to speed certain operations...
just wondering if it works in this minor case too.

Andrew Ferguson

--- In ib-support@y..., "Marcos Vinicius" <dufloth@t...> wrote:
> Hi. What is more eficient (I mean less time to execute) to verify
if exists at least one row of some table inside an trigger or
procedure: if (exists(select * from t where f1 = v1...) or select
first 1 * from t1 where f1 = v1... into :var1?
> TIA,
> Dufloth.
> [Non-text portions of this message have been removed]