Subject | Optimizing in (...) Statements |
---|---|
Author | m_quadrat |
Post date | 2004-10-14T10:43:47Z |
Hallo all,
I'm currently trying to optimize one of my queries wich includes two
in (...) statements. Can't post the query right now, 'cause Firebird
broke down.
where
Field1 in (1,2,3) and
Field2 in (1,2)
This query takes ages. I tried to replace the in (...) statements
with:
where
Field1 = 1 and
Field2 = 1
union all
where
Field1 = 1 and
FIeld2 = 2
....
This runs much faster. Isn't there an easier way?
I'm currently trying to optimize one of my queries wich includes two
in (...) statements. Can't post the query right now, 'cause Firebird
broke down.
where
Field1 in (1,2,3) and
Field2 in (1,2)
This query takes ages. I tried to replace the in (...) statements
with:
where
Field1 = 1 and
Field2 = 1
union all
where
Field1 = 1 and
FIeld2 = 2
....
This runs much faster. Isn't there an easier way?