What is the difference between a single query and a split query in EF Core?

Entity Framework & EF Core Performance Advanced 3–5 Yrs5+ Yrs Conceptual 1 min read

Quick Answer

With multiple collection Includes, a single query joins everything, so parent rows are duplicated once per child combination — a cartesian explosion that can transfer huge amounts of data. AsSplitQuery() issues a separate SQL query per included collection, avoiding the duplication at the cost of extra round-trips and a small consistency risk.

When you Include more than one child collection, EF's default is a single big join. The problem is the parent row gets repeated for every combination of children — if an order has 10 items and 10 status-history rows, you get 100 rows back with the order columns duplicated 100 times. AsSplitQuery tells EF to run one query for the orders, one for the items, one for the history, and stitch them in memory. It's much less data on the wire, but it's several round-trips and the queries aren't a single consistent snapshot, so if that matters I put them in a transaction.

  • One collection include → single query is fine. Two or more → consider split.
  • Split query downside: the separate queries aren't in one snapshot, so concurrent writes between them could give a slightly inconsistent graph (wrap in a transaction / snapshot isolation if it matters).
  • Set the default with UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery), override per-query with AsSingleQuery().