Subject Another Unoptimized question
Author skander_sp
May be obvious, but til now, i don't see how much unoptimized works the "field in subselect" syntax.

I'm using it in some procedure, just right til now, after check they work in the worse unoptimized mode...

example:

select * from Table1 T1
where T1.id in (select T2.id
from Table2 T2
where T2.Customer=:customer)

of course T2.id is a Primary key and T1.id is a Foreing key

I think they resolve getting the value(s) in the subselect, and then applying to the main where, but the performace analisys show he run all the T1 table from begin to end and then check with the subselect

of course I can solve (in procedure) with a FOR subselect to get every value and check after.... not the nicest way, and pretty ugly and less "human readable", but by far much more quick and optimized.

for select T2.id
from Table2 T2
where T2.Customer=:customer
into :id do
select * from Table1 T1
where T1.id=:id

There is some way to get a good result using "field in subselect"? some trick to get an optimized result using this syntax?