October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

IQueryable vs IEnumerable in C#: Where LINQ Stops and SQL Begins

IEnumerable processes sequences locally; IQueryable gives a provider an expression tree to interpret. See when EF Core translates LINQ to SQL, when queries execute, and why AsQueryable does not turn a list into a database query.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

IEnumerable<T> describes a sequence that LINQ can process locally; IQueryable<T> describes a query as an expression tree for a provider to interpret. With EF Core and a relational database, supported parts of an IQueryable query can become SQL—but the interface alone does not mean a database is involved. The source, provider, operator representation, and moment the query is consumed all matter.

What is the difference between IQueryable and IEnumerable in C#?

The key distinction is how query operations are represented and run. LINQ operators for IEnumerable<T> use delegates to process values in the application. Operators for IQueryable<T> build an expression tree that a query provider can inspect and translate or otherwise interpret. Microsoft’s standard query operators overview describes this difference between local sequence processing and provider-based queries; the IQueryable<T> documentation describes the expression tree and provider.

As an Amazon Associate I earn from qualifying purchases.

Question IEnumerable<T> / LINQ to Objects Provider-backed IQueryable<T>
How are operators represented? As delegates that run against sequence values locally. As expression trees for a provider to interpret.
Where does work happen? In the application, over the sequence being enumerated. Provider-dependent. EF Core can send supported operations to a relational database.
What limits the query? Ordinary C# code can run locally, subject to available values and resources. The provider’s translation capabilities and the target database’s query language.
When does deferred work begin? When the sequence is enumerated; scalar operators and materializers consume it immediately. When results are consumed, such as by enumeration or a terminal operation.
What is the main memory concern? Work runs over values available to the application. Client-side work can require fetching rows; ToList buffers results, while AsEnumerable does not create a list.

These are related but separate questions: where the source lives, how operators are represented, and when results are consumed. A sequence may be in memory or database-backed; its static type and provider determine which LINQ operators apply. Both common LINQ patterns can defer work, so “deferred” does not mean “runs in SQL.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does IQueryable mean a query will run in SQL?

No. IQueryable<T> means there is an expression tree and a provider. EF Core is one such provider: for a relational source such as context.Blogs, it can translate supported expressions into SQL. Other providers may target different systems or behave differently, and some expressions may not translate. The Microsoft expression-tree overview explains the representation; the LINQ overview describes LINQ’s use across different data sources.

Do not infer that every C# expression becomes SQL, or that IQueryable is inherently faster. Pushing a selective filter or projection to a database can reduce transferred data, but translation support, indexes, result size, round trips, and any later client-side processing affect performance. There is no universal speed advantage independent of the workload.

When does an EF Core query execute?

Building a query usually builds an in-memory representation; it does not necessarily contact the database. EF Core sends a database query when results are consumed, for example through iteration, ToList, ToArray, Single, Count, or corresponding asynchronous operations. See Microsoft’s EF Core query execution overview.

int minimum = 4;

var query = context.Blogs
    .Where(b => b.Rating > minimum)
    .Select(b => new { b.BlogId, b.Url });

var blogs = await query.ToListAsync();

The Where and Select calls describe a provider query. If EF Core can translate them for the database provider in use, the filter and projection can be performed in the database. ToListAsync() consumes the query and stores the returned results in a list. It is a materialization boundary: after this call, blogs is an in-memory collection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Client evaluation in EF Core

EF Core’s current guidance says it attempts to evaluate a query on the server as much as possible. In EF Core 3.0 and later, client evaluation is allowed in the top-level projection; an untranslatable expression elsewhere in the query normally causes a runtime exception. For example, if a local helper is used in the final Select, EF Core may fetch the required columns and run that projection work in the application. Put the same unsupported helper in Where, and translation failure normally raises an exception instead of silently filtering every fetched row locally.

This version boundary matters: before EF Core 3.0, broader client evaluation was permitted and could produce a warning rather than an exception. Translation details still depend on the provider and version. Microsoft’s client-versus-server evaluation guidance, updated 2025-09-06, describes the current boundary and the historical change.

What do AsEnumerable and AsQueryable change?

AsEnumerable() changes which operators apply after that point: subsequent LINQ operators are LINQ-to-Objects, running locally as the sequence is enumerated. It does not itself execute the query or buffer all results into a list. This can be useful when a later operation cannot be translated, but results may need to be fetched before that local operation can run. Consider how many rows cross that boundary and how much client-side work or memory they require.

AsQueryable() is not a switch that attaches a database. Applied to an ordinary in-memory sequence such as a List<Blog>, it wraps the sequence so query operations use the Enumerable implementations; it does not give the list a remote provider or turn its operations into SQL. If its source already implements IQueryable<T>, the provider-backed query can be retained. See Microsoft’s Queryable.AsQueryable documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When does IEnumerable work run?

For LINQ to Objects, sequence operators such as Where and Select commonly use deferred execution: they do their work as the sequence is enumerated. Scalar operators such as Count, Max, Average, and First consume the sequence and return a result. ToList and ToArray also consume it, then cache the values in a collection. Microsoft’s LINQ query introduction explains deferred and immediate execution.

Enumerating a deferred query again may repeat its work, and may produce different results if the underlying data has changed. In contrast, enumerating a list created by ToList reads the already-materialized values; it does not rerun the original query.

Which type should you use?

  • Use IQueryable<T> while composing a provider-backed query when you want the provider to translate supported filters, ordering, or projections before results are returned.
  • Use IEnumerable<T> for local sequence processing when the values are already in memory or you intentionally want subsequent operators to run in the application.
  • Choose a deliberate boundary. A call to AsEnumerable changes the following operators to local processing; ToList or ToArray additionally consumes and buffers the results.
  • Check translation rather than assuming it. Keep provider-backed filters and projections to expressions your provider supports, and be conscious of rows fetched before client-side work.

The right choice is not a contest between two universally faster interfaces. It is a choice about which component should interpret each operation and where the required data should be processed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.