Subject Re[2]: [ib-support] Is these SQL statement result equal ?
Author Roland Turcan
AG> Roland Turcan wrote:

>>Hello ib-support@yahoogroups.com!
>>
>>1.
>>
>>SELECT * FROM POKLADNA
>>WHERE JEDIN IN (SELECT RECORD_ID FROM SYS$REP
>> WHERE TABULKA='POKLADNA' AND
>> ZMENA<>'D' AND
>> JEDIN>40000
>>);
>>
>>
>>2.
>>
>>select *
>>from pokladna a
>>join sys$rep b on b.record_id=a.jedin
>>and b.tabulka='POKLADNA' and b.ZMENA<>'D'
>>and b.JEDIN>40000;
>>
>>So ?
>>
>>

<<< 20. 9. 2002 15:54 - Andrew Guts "andr@..." >>>
AG> (1) selects all columns from first table, but (2) selects all columns
AG> from both. (2) may cause column name conflict.

(2) Ohh, yes, I forgot so this must be like:

select a.* from pokladna a...


AG> Both statements are targeted to return the same rows, but first may fail
AG> if subselect returns huge recordset. Join (in 2) is more effective.

1. time to result is 7.5second
2. time to result is 50-60 msecs. - this is very OK

--
Best regards, TRoland
http://www.rotursoft.sk