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 grades results, round trips, generated SQL, and execution plans across 206 database coding challenges.

No signup or setup. Start with Filter Before You Fetch, then explore the full Pro path.

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 every query

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, cost, 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.

High-Performance Data Access

A deliberate route from LINQ to query plans

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

Free EF Core and SQL exercises

Open 7 database katas without an account

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

  1. 01 Easy

    Filter Before You Fetch

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

    Open this database kata →
  2. 02 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 →
  3. 03 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 →
  4. 04 Medium

    Customers Without Orders

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

    Open this database kata →
  5. 05 Medium

    Customer Order Totals

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

    Open this database kata →
  6. 06 Medium

    Top Spending Customers

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

    Open this database kata →
  7. 07 Easy

    Your First SELECT

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

    Open this database kata →

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 visible examples as often as you need.
  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 and execution plan produced by the submission instead of simulating database behavior.

What EF 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