Subject RE: [IBO] ibo_cursor
Author Bill Morrison
Definitely avoid count, since it returns *all* the records that match that
criteria, it will walk the entire table (or appropriate indexes).

The fastest way I've found, assuming you have decent indexing set up, is to
just do

select the_pk
from sometable
where someconditions

Make sure that autofetchall is turned off, open the cursor, and see if the
pk is null. If it isn't then at least one of the records exist.

HTH



Bill

-----Original Message-----
From: comesailing@... [mailto:comesailing@...]
Sent: Thursday, September 06, 2001 3:31 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] ibo_cursor


Simple question from a simple mind.
What is the absolute fastest way of determining whether a big table
has a particular record ?

Suppose we have table with columns A,B,C, and D of which A is primary
key.
Can do, "select Count(A) from mytable where B=5 and C=6 and D=7" say
and if count is 0 we have no such record.

Or can do "select A from mytable where B=5 and C=6 and D=7" and if A
is null we have no such record.

Or Locate ... ??
Having to do many of these within a loop it is desirable to fnd the
fastest.
Any Advice Please.

Dave





Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/