Too many values in an IN list / too many parameters (limit exceeded)
A huge IN (...) list or too many bound parameters exceeds a database limit.
too many parameters IN listThe incoming request has too many parameters. The server supports a maximum of 2100 parametersORA-01795 maximum number of expressions in a list is 1000too many SQL variablesbind variables limit exceeded IN clause Meaning
Limits differ: SQL Server 2100 parameters, SQLite 32766 (older 999), Oracle 1000 items per IN list, PostgreSQL 65535 parameters, MySQL max_allowed_packet. Batch the values, load them into a temp table or table-valued parameter and join, or use = ANY(array) in PostgreSQL.
Common causes
- ORM generating a giant IN list
- Bulk fetch by many IDs
- Exceeding parameter count limit
- Query text larger than
max_allowed_packet - Oracle's 1000-item IN limit
⚡ Quick fix
- Batch IDs into chunks of 500-1000
- Use a temp table/table-valued parameter and JOIN
- PostgreSQL:
WHERE id = ANY($1)
Detailed fix by platform
SQL
SELECT * FROM orders WHERE id = ANY($1::bigint[]);
How to diagnose
- List size — Over the limit?
- Alternative — Temp table/array?
- Driver — Binds each value?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026