Subject Re: [firebird-support] IN clause - using static values vs table values
Author PenWin
----- Original Message -----
From: "Gary Benade" <gary@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, August 08, 2006 12:07 PM
Subject: [firebird-support] IN clause - using static values vs table values


> This was posted in IBO earlier by mistake. Sorry.
> Say I have a table TEMP containing the values 1,2,3,4
> SELECT * FROM LARGETABLE WHERE MAININDEXVALUE IN (1,2,3,4)
> SELECT * FROM LARGETABLE WHERE MAININDEXVALUE IN ( SELECT * FROM TEMP)
>
> Does the second statement get optimised to execute as efficiently as the
> first, or is there a performance penalty?

I used something similar in my application. The second SELECT took as much
as 30 minutes, the first one about 0.01 seconds (plus some 0.02 seconds for
constructing the IN (values), of course). Firebird 1.5.

Pepak