ORA-01795 when querying with .Contains on large lists
Posted: Tue 03 Mar 2020 13:06
Framework: Entity Framework Core 3.1
Provider: Devart.Data.Oracle.EFCore 9.11.951
Issue:
The following LINQ query worked fine in Devart.Data.Oracle.EFCore 9.7.805 (Entity Framework Core 2.2):
Since Oracle only allows max 1000 expressions in a list, it nicely split the query:
However, version 9.11.951 generates the following query, resulting in a ORA-01795: maximum number of expressions in a list is 1000
Provider: Devart.Data.Oracle.EFCore 9.11.951
Issue:
The following LINQ query worked fine in Devart.Data.Oracle.EFCore 9.7.805 (Entity Framework Core 2.2):
Code: Select all
var ids = Enumerable.Range(0, 10000).ToArray();
dbContext.Set<Person>().Where(person => ids.Contains(person.Id)).ToListAsync();
Code: Select all
SELECT "_".ID,
...
FROM PERSON "_"
WHERE "_".ID IN (0, 1, 2, ... 999)
OR "_".ID IN (1000, 1001, 1002, ... 1999)
OR "_".ID IN (2000, 2001, 2002, ... 2999)
...
Code: Select all
SELECT "_".ID,
...
FROM PERSON "_"
WHERE "_".ID IN (0, 1, 2, ... 9999)