Subject speed of subselect question
Author andy@camavision.com
I have a question about getting the best speed using a subselect.
Does the subselect get re-run always?

First the query: (it returns a list of keys based on some condition,
except for thoes which are locked (*i.e. in the modulelock table*))

select gid from general
where pdfnum in (1)
and mapcode in (37)
and not gid in (
select locknum
from modulelock
where
locknum = general.gid and -- This Line!!
(locktype in (4)
or (locktype in (1) and userid <> 2))
)

My question is about the subselects condition (locknum = general.gid)
which makes the subquery find the one or two specific rows based on
the outside queries current position. If I remove it, I'll get a
record set that can be run once and used for every record of the
outter query.

So my queston: so FB always rerun subselects? The one written above
will always have to be rurun, whereas this one would not:

select gid from general
where pdfnum in (1)
and mapcode in (37)
and not gid in (
select locknum
from modulelock
where
(locktype in (4)
or (locktype in (1) and userid <> 2))
)

does FB do that?

Thanks all

-Andy