Subject Re: [ib-support] First Keyword (Performance question, not related to why is it there)
Author Svein Erling Tysvær
Hi Jason!

>select first 1 lname from people where lname = 'Smith'; // Only grabs the
>first, but has to return a string. Result string has the potential to be
>large, depending on column definition

This should be OK and you don't have to select a column if the potential
length worries you - you could just do
select first 1 1 from people where lname = 'Smith'

>select count(*) from people where lname = 'Smith'; // Has to count
>everything, but it returns a single integer. My thought is that the index
>might have this number already.

This could be considerably slower, especially if Smith should happen to be
a common name ;=)

Another option you do not mention at all, is to use exists. I think it can
be used directly within stored procedures and if you work with client
applications you can do something like

WHERE EXISTS(select 1 from people where lname = 'Smith')

But I think your first option (select first 1) should execute equally quick.