Subject RE: [firebird-support] select sql comparison
Author sugi
> select col1, col2, (select col3 from tableb t2 where t2.colx
> = t1.colx) as co3
> from tablea t1
>
> or
>
> select t1.col1, t1.col2, t2.col3
> from tablea t1 leftjoin tableb t2 on t1.colx = t2.colx
>
> which query will result to a faster execution?Let say the
> colx is index. Will the difference bevery big in a large dataset?
I posted a similar question a while ago. It seems that in both FB1.0.2
and FB1.5RC1 (back then) the first version will *seem* to be faster.
Somebody (my apologies, I don't remember who) on the list wrote that the
*total* time is supposed to be very similar, but the first query returns
faster because it's doing more work per 'record fetch', while the second
query does more thing up front, with faster fetches later.

> by the way do we call the first query as embeded select or
> nested select or sub select?
Good question, I don't know the answer, but I used to call it a
'subquery'...:)

Salam,
sugi.