Skip to content
Katabench
Try free

EF Core exercises on real PostgreSQL

EF Core practice where the query plan is part of the grade

Write LINQ and SQL in the browser, run it against realistic data, and see what the database actually did. Katabench shows the SQL your code generates on the sample tests of all 206 database coding challenges, captures the execution plan on 195 of them, and grades the plan's shape on 58.

No signup or setup. Start with Project Only the Names, then explore the full Pro path.

Katabench results after a real Submit on the Project Only the Names kata, of a version that calls ToList before Select. The verdict reads Failed: query plan rule, with 4 / 4 tests passed and 3 / 5 query-plan rules holding. Under Your query plan, the rules for a single SQL statement, a direct customer scan followed by the sort, and ordering the names in the database pass, while two red rules say the root plan may output at most 1 column and the query must return name directly.
A real Submit on Project Only the Names: every test passes, and two query plan rules still fail the solution.
database exercises
206
database engine
Postgres
free to try
7

The database tells the truth

The right rows the wrong way can still fail

A query can return exactly the expected data and still scan every row, make forty round trips, or pull the table into memory. The result alone cannot teach you that. The generated SQL and the plan can.

Your query plan, captured from the database, graded

The obvious filter

.Where(t => t.TappedAt.AddHours(offset).Year == year && t.TappedAt.AddHours(offset).Month == month)

Sort (by id)

Seq Scan on taps

60,000 rows read · ⚠ full table read

  • ✗ No full-table scan on taps
  • ✗ Uses ix_taps_tapped_at
  • ✓ One round-trip

✗ 1 / 3 plan rules hold

The sargable rewrite

.Where(t => t.TappedAt >= start && t.TappedAt < end)

Sort (by id)

Index Scan on taps using ix_taps_tapped_at

100 rows read · ✓

  • ✓ No full-table scan on taps
  • ✓ Uses ix_taps_tapped_at
  • ✓ One round-trip

✓ 3 / 3 plan rules hold

Same rows returned. Same green tests. Only one earns the index scan, and the grade.

See the queries

Inspect the SQL produced by your LINQ and catch N+1 behavior where it starts.

Read the real plan

Expand the captured PostgreSQL plan and see scans, index use, and row estimates.

Pass explicit rules

A challenge can require one round trip, forbid a full-table scan, or demand index use.

See the mechanics in the grading guide, then study the classic failure in the EF Core N+1 guide and learn to read the evidence in EF Core query plans and indexes. The catalog has the full list of database katas.

High-Performance Data Access

A deliberate route from LINQ to query plans

Open practice lets you choose from the full database catalog. The Learning Path orders 19 exercises so each relational idea supports the next one.

The Katabench Learning Path page for High-Performance Data Access: 5 sections, 19 exercises and about 5.5 hours, an Unlock the full path card saying 12 exercises need Pro and 7 are free to try now, a completion reward of a path badge, 250 XP and 25 gems, and the three skills the path proves.
Section 1 of the High-Performance Data Access Learning Path, Shape the query on the server, listing four numbered exercises, each with a free preview tag: Filter Before You Fetch, Project Only the Names, Existence Without Loading and Customers Without Orders.

Free EF Core and SQL exercises

Open 7 database katas without an account

Each one runs against a seeded PostgreSQL database and the same grader as the rest of the track. Pro unlocks the other 199.

  1. Easy

    Project Only the Names

    Select just the customer names server-side instead of materializing whole entities to read one column.

    Open this database kata: Project Only the Names Read the brief: Project Only the Names
  2. Easy

    Filter Before You Fetch

    Filter measurements on the database, not after loading the whole table.

    Open this database kata: Filter Before You Fetch Read the brief: Filter Before You Fetch
  3. Easy

    Existence Without Loading

    Answer a yes/no existence question by asking the database, not by loading the rows to count them.

    Open this database kata: Existence Without Loading Read the brief: Existence Without Loading
  4. Medium

    Customers Without Orders

    Find customers who never ordered with one anti-join instead of an N+1 loop.

    Open this database kata: Customers Without Orders Read the brief: Customers Without Orders
  5. Medium

    Customer Order Totals

    Sum each customer's orders with a single SQL query instead of an N+1 loop.

    Open this database kata: Customer Order Totals Read the brief: Customer Order Totals
  6. Medium

    Top Spending Customers

    Return the highest-spending customers with one ranked query, not an N+1.

    Open this database kata: Top Spending Customers Read the brief: Top Spending Customers
  7. Easy

    Your First SELECT

    Write a raw SQL query with Dapper: filter rows with WHERE and sort with ORDER BY.

    Open this database kata: Your First SELECT Read the brief: Your First SELECT

Built for working developers

Practice the query shape, not ORM trivia

The goal is not to memorize one EF Core method. It is to look at a LINQ expression and predict where filtering happens, how many times the application crosses the network, and whether the available index can satisfy the access pattern.

That judgment transfers from one ORM version to the next. Katabench gives you enough focused attempts, and enough evidence after each one, to turn it into a reflex.

A typical practice loop

  1. 1 Read the requested data shape and the performance constraint.
  2. 2 Write LINQ or SQL, then run the samples before you spend a submission.
  3. 3 Submit against realistic data and inspect queries, timings, and the plan.
  4. 4 Rewrite until the result and the access path both pass.

EF Core practice FAQ

What you need to know

Do the EF Core exercises use a real database?

Yes. Database challenges run against PostgreSQL with seeded data. Katabench captures the SQL your submission produces, and on katas with plan rules its execution plan, instead of simulating database behavior.

What Entity Framework Core skills can I practice?

The catalog covers server-side filtering and projection, joins, aggregates, round trips, query shaping, sargable predicates, index use, pagination, raw SQL, and related data-access patterns.

Do I need PostgreSQL or the .NET SDK installed?

No. You write the solution in the browser, and Katabench compiles and runs it with the seeded database in an isolated server-side environment.

Is there a structured EF Core Learning Path?

Yes. High-Performance Data Access orders 19 exercises from query shaping through plans, indexes, SQL, and analytical queries. It is included with Pro.

New to query shaping? Start with the ordered LINQ exercises. Looking for broader practice? Browse all C# coding challenges across performance, refactoring, architecture, security, and testing.

Make the database show its work

Try a free query-shaping exercise, then continue with 19 ordered exercises through LINQ, SQL, query plans, and indexes in the Pro path.

Try a free EF Core exercise