<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h" -->

---
title: Filtering EF Core by a Large List: The 2,100 Parameter Wall
description: EF Core 10 changed how the default Contains() translation sends large lists to SQL Server, and the real usable parameter ceiling is 2,098, not 2,100, because...
canonical: https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Filtering EF Core by a Large List: The 2,100 Parameter Wall | daily.dev
og:description: EF Core 10 changed how the default Contains() translation sends large lists to SQL Server, and the real usable parameter ceiling is 2,098, not 2,100, because...
og:url: https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h
og:image: https://api.daily.dev/og/posts/nzDnHnZ2H.png
og:image:alt: Filtering EF Core by a Large List: The 2,100 Parameter Wall
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Filtering EF Core by a Large List: The 2,100 Parameter Wall

**[Code with Mukesh](https://daily.dev/sources/codewithmukesh)** · [@iammukeshm](https://daily.dev/iammukeshm) · 31 min read · 24 upvotes · 0 comments

## Summary

EF Core 10 changed how the default Contains() translation sends large lists to SQL Server, and the real usable parameter ceiling is 2,098, not 2,100, because sp_executesql itself consumes two parameters. Below 2,098 parameters EF sends one scalar parameter per value (with padding to stabilize the plan cache); above that ceiling it silently falls back to a single JSON parameter processed via OPENJSON, so Contains no longer throws even at 100,000 IDs. Benchmarks across seven approaches (default Contains, EF.Parameter, EF.Constant, chunking, hand-rolled temp tables, WhereBulkContains, WhereContains) on a one-million-row table show the default is up to 8x slower than EF.Parameter in the 1,000-2,098 range, EF.Constant collapses at scale, chunking is consistently the weakest option, and hand-rolled temp tables win at 100,000+ rows. Composite key filtering has no built-in IN translation at all: OR-chain predicates crash with stack overflows past a few hundred pairs or hit the real 2,100 parameter error, leaving temp tables or the paid WhereBulkContains library as the only reliable options.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://codewithmukesh.com/blog/ef-core-contains-large-list>

## Questions this post answers

### Why did my EF Core query get slower after upgrading to EF Core 10?

EF Core 10 changed the default translation of parameterized collections from a single JSON array parameter to one scalar parameter per value. For lists of roughly 1,000 to 2,098 items this is measurably slower: a 2,098-item list took 34.6 ms with the default translation versus 4.3 ms wrapped in EF.Parameter, which restores the old behavior for that query.

_Teams upgrading EF Core can compare version-specific translation changes like this on daily.dev before they hit production._

### What is the real maximum number of parameters EF Core 10 can send to SQL Server in a Contains query?

The usable ceiling is 2,098, not the commonly cited 2,100. SQL Server documents 2,100 parameters per stored procedure, but SqlClient sends queries through sp_executesql, which itself consumes two parameters, and this was corrected in EF Core 10.0.2. Below that limit EF sends scalar parameters (with padding); crossing it, EF silently switches to a single JSON parameter via OPENJSON instead of throwing.

_Developers tuning query limits across EF Core versions can track fixes like this one on daily.dev before benchmarking._

### How do I filter an EF Core query by a list of composite keys larger than a few hundred pairs?

EF Core 10 cannot translate Contains, Any, or tuple-based predicates over composite keys directly; they all fail with a LINQ translation error. A hand-built OR chain from a loop creates a left-deep expression tree that crashes the process with a stack overflow around 490 pairs, while a balanced OR tree survives to 1,049 pairs before hitting the real 2,100 parameter error. The reliable fix is staging the keys in a temp table joined on both columns, or using a library like WhereBulkContains that does the same internally with zero parameters.

_Engineers hitting composite-key filtering limits can find fixes like temp-table staging discussed on daily.dev._

## Similar posts on daily.dev

- [The N\+1 Query Problem in EF Core: Detection, Diagnosis, and Permanent Fixes - Chris Woody Woodruff](https://daily.dev/posts/the-n-1-query-problem-in-ef-core-detection-diagnosis-and-permanent-fixes---chris-woody-woodruff-1wjglh6js) · We Are .NET · 4 upvotes · 0 comments
- [EF Core 10–Smarter parameterized collections](https://daily.dev/posts/ef-core-10-smarter-parameterized-collections-lkxbqflmc) · The Art of Simplicity · 7 upvotes · 0 comments
- [ClickHouse Will Let You Be Wrong at Scale](https://daily.dev/posts/clickhouse-will-let-you-be-wrong-at-scale-prxaelmw6) · Mat Duggan · 1 upvotes · 0 comments
- [5 EF Core Performance Anti-Patterns That Entity Framework Extensions Eliminates - Chris Woody Woodruff](https://daily.dev/posts/5-ef-core-performance-anti-patterns-that-entity-framework-extensions-eliminates---chris-woody-woodru-jhx3mqlpv) · We Are .NET · 1 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Filtering EF Core by a Large List: The 2,100 Parameter Wall","url":"https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h"},"datePublished":"2026-09-13T18:01:07.791Z","dateModified":"2026-09-14T15:00:18.304Z","description":"EF Core 10 changed how the default Contains() translation sends large lists to SQL Server, and the real usable parameter ceiling is 2,098, not 2,100, because...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a6a8e6815936aa17682e22a2e87379b5?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a6a8e6815936aa17682e22a2e87379b5?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Code with Mukesh","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Mukesh Murugan","url":"https://daily.dev/iammukeshm","image":"https://lh3.googleusercontent.com/a-/AFdZucr2UBIpOeVTWohK8XKuXPOutNG6hgyQMz7CYj7LEA=s100","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":1020}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":24},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,.net,c#,microsoft-sql-server","timeRequired":"PT31M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code with Mukesh","item":"https://daily.dev/sources/codewithmukesh"},{"@type":"ListItem","position":3,"name":"Filtering EF Core by a Large List: The 2,100 Parameter Wall"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/filtering-ef-core-by-a-large-list-the-2-100-parameter-wall-nzdnhnz2h#faq","mainEntity":[{"@type":"Question","name":"Why did my EF Core query get slower after upgrading to EF Core 10?","acceptedAnswer":{"@type":"Answer","text":"EF Core 10 changed the default translation of parameterized collections from a single JSON array parameter to one scalar parameter per value. For lists of roughly 1,000 to 2,098 items this is measurably slower: a 2,098-item list took 34.6 ms with the default translation versus 4.3 ms wrapped in EF.Parameter, which restores the old behavior for that query. Teams upgrading EF Core can compare version-specific translation changes like this on daily.dev before they hit production."}},{"@type":"Question","name":"What is the real maximum number of parameters EF Core 10 can send to SQL Server in a Contains query?","acceptedAnswer":{"@type":"Answer","text":"The usable ceiling is 2,098, not the commonly cited 2,100. SQL Server documents 2,100 parameters per stored procedure, but SqlClient sends queries through sp_executesql, which itself consumes two parameters, and this was corrected in EF Core 10.0.2. Below that limit EF sends scalar parameters (with padding); crossing it, EF silently switches to a single JSON parameter via OPENJSON instead of throwing. Developers tuning query limits across EF Core versions can track fixes like this one on daily.dev before benchmarking."}},{"@type":"Question","name":"How do I filter an EF Core query by a list of composite keys larger than a few hundred pairs?","acceptedAnswer":{"@type":"Answer","text":"EF Core 10 cannot translate Contains, Any, or tuple-based predicates over composite keys directly; they all fail with a LINQ translation error. A hand-built OR chain from a loop creates a left-deep expression tree that crashes the process with a stack overflow around 490 pairs, while a balanced OR tree survives to 1,049 pairs before hitting the real 2,100 parameter error. The reliable fix is staging the keys in a temp table joined on both columns, or using a library like WhereBulkContains that does the same internally with zero parameters. Engineers hitting composite-key filtering limits can find fixes like temp-table staging discussed on daily.dev."}}]}
```

