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 130 database coding challenges.

database exercises
130
database engine
Postgres
mocked query plans
0

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(o => o.PlacedAt.Year == 2024 && o.PlacedAt.Month == 3)

Sort (by id)

Seq Scan on orders

~60,000 rows · ⚠ full table read

  • No full-table scan on orders
  • Uses the placed_at index
  • One round-trip

✗ 1 / 3 plan rules hold

The sargable rewrite

.Where(o => o.PlacedAt >= start && o.PlacedAt < end)

Sort (by id)

Index Scan using ix_orders_placed_at

~1,017 rows · ✓

  • No full-table scan on orders
  • Uses the placed_at index
  • 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.

01

4 exercises

Shape the query on the server

Stop fetching rows and fixing the result in application memory.

02

4 exercises

Aggregate with intent

Make grouping, totals, and rankings happen in one round trip.

03

4 exercises

Write the SQL directly

Practice the same relational ideas without an ORM between you and the plan.

04

4 exercises

Make the index count

Write predicates and ordering that line up with the available access path.

05

3 exercises

Analytical queries

Finish with reporting patterns that stay set-based as requirements grow.

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

Follow 19 ordered exercises through LINQ, SQL, query plans, and indexes, with real PostgreSQL feedback on every submission.

Explore High-Performance Data Access

Get new puzzles and .NET tips in your inbox

A short note when fresh kata land, plus the C# and performance tricks behind the grading. No spam, unsubscribe anytime.