Subject Re: [firebird-support] The known limit (1499) in IN clause
Author Milan Babuskov
partsi wrote:
> Firebird does not support more than 1499 elements in an IN clause
> list. Is there any effort to raise this limit? I understand that we
> must try to avoid cases where the number of elements in an IN list is
> big, but there are circumstances such as DSQL (e.g. using DSQL in a
> c++ code) where we are faced with this limit. For example, an
> application receives 2000 identifiers

From where?

Whatever gives 2000 identifiers to it, should be changed to do it in
some more efficient manner. It's hard telling what exactly without
knowing the details.

For example, you could have a table with two columns: useID, ID, where
useID is filled each time you pick 2000 values with a single value which
can be obtained from generator for example:

- X = new value from generator
- create a list of 2000 IDs
- insert into use_table(useID, ID) values (X, ID <- 2000 times)
- make sure you have index on (useID,ID)
- write the final query as

select *
from <table> t
join use_table u on u.useID = X and t.ID = u.ID


select *
from <table> t
where exists (
select 1 from use_table u where u.useID = X and t.ID = u.ID )

Milan Babuskov