Subject RE: [firebird-support] Query is running slowly for the first time.
Author Leyne, Sean
Bruce,

> I am having problem with the query which is constructed like this:
>
> SELECT S.Column1, S.Column2, STORED_PROC.Column1,
> STORED_PROC.Column2 FROM TABLE SomeTable S LEFT JOIN
> STORED_PROC(S.UniqueID) ON 1=1 WHERE S.Data >= '01.07.2012' AND S.Data
> <='09.07.2012'

Is S.Data indexed?

If not, then I would use the following SQL:

SELECT
T.Column1, T.Column2,
STORED_PROC.Column1,STORED_PROC.Column2
FROM (
SELECT
S.UniqueID,
S.Column1,
S.Column2
FROM SomeTable S
WHERE
S.Data BETWEEN '01.07.2012' AND '09.07.2012'
) T
LEFT JOIN STORED_PROC( T.UniqueID) ON 1=1