IN list SQL Origin: Data OSI layer 7 · Application Last updated 18 Nov 2026

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.

Exact message you may see 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
Seen on: SQL SQL Server Oracle SQLite

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

  1. Batch IDs into chunks of 500-1000
  2. Use a temp table/table-valued parameter and JOIN
  3. PostgreSQL: WHERE id = ANY($1)

Detailed fix by platform

SQL

  1. SELECT * FROM orders WHERE id = ANY($1::bigint[]);

How to diagnose

  1. List size — Over the limit?
  2. Alternative — Temp table/array?
  3. 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:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

201 — SQL Server Msg 201: Procedure or function expects parameter '@X', which was not supplied (SQL)201cartesian — Query returns far too many rows: accidental Cartesian product (missing JOIN condition) (SQL)cartesianCASE — CASE expression returns mixed types: conversion failed / types cannot be matched (SQL)CASECOUNT — COUNT(column) ignores NULLs: counts differ from COUNT(*) (SQL)COUNTEMFILE — Too many open files (EMFILE) (Linux)EMFILEfork: retry: Resource temporarily unavailable — fork: retry: Resource temporarily unavailable (process/thread limit) (Linux)fork: retry: Resource…LIKE — LIKE matches too much: _ and % are wildcards (escape them) (SQL)LIKElimits — Firestore: Invalid Query. 'in' filters support a maximum of 30 elements (query limits) (Google Cloud / Firebase)limitsIN list

Explore the map of this error Full error map →

🧠 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.