/talk-end-of-n-1

Talk about how Spring Data JDBC will solve the N+1 problem

How to load Aggregates with a Single query

This talk teaches you how Spring Data JDBC will in the future load aggregates in a single query. While the motivation for the talk is based in Spring Data JDBC it is more of an advanced SQL tutorial.

You can find the current version of the slides on google drive. A unmodifiable version can be found in this repository as pdf. Of course, unmodifiable is in the sense of Git: you may pull a certain version from the version history.

The queries used in the demo part are in this repository named query0n_*.sql. Take a wild guess in which order to execute them.

Setup

You’ll need a database to execute the examples. They were created using a Postgres database on docker:

Execute docker run to start a postgres database in a container.

docker run --name single-query-postgres -e POSTGRES_PASSWORD=not-a-secret -d -p 5432:5432 postgres:15.1

Check the database is up and running with psql.

psql postgres://postgres:not-a-secret@localhost/postgres

Use your preferred SQL tool to run the setup.sql script in order to create the required tables.