inflearn logo

A DBA Dissects SQL Generated by JPA — Execution Plans for N+1 Queries, Fetch-Join Pagination, Batch INSERTs, and Bulk Operations

We measure from MySQL’s side—not application logs—how many statements and rows a single line of JPA code generates, and what execution plans it uses. This practical course, taught by a team lead currently working as a DBA, reproduces and fixes N+1 queries, pagination with collection fetch joins, IDENTITY batch inserts, bulk operations, readOnly, and OSIV across 61 hands-on tests—and proves the results with numbers.

1 learners are taking this course

Level Intermediate

Course period Unlimited

JPA
JPA
spring-data-jpa
spring-data-jpa
MySQL
MySQL
hibernate
hibernate
database-tuning
database-tuning
JPA
JPA
spring-data-jpa
spring-data-jpa
MySQL
MySQL
hibernate
hibernate
database-tuning
database-tuning

What you will gain after the course

  • It counts the number of statements a request sends to the DB using performance_schema digests and status counters.

  • Find hidden queries such as N+1, three-level N+1, inverse @OneToOne, and @Formula; fix them with fetch joins, batch fetching, and DTOs, then compare execution plans.

  • We measure why pagination with a collection fetch join produces SQL without a LIMIT and the cost of counting pages, then address these issues with Slice, keyset, and ID-first pagination.

  • Why batching doesn’t work with IDENTITY: Proving the effects of rewriteBatchedStatements, Persistable, and commit size by counting statements.

  • We cover execution plans and locking ranges for bulk UPDATE/DELETE operations, persistence context inconsistencies, and chunking large deletes from an operational perspective.

  • Record code locations in SQL comments, and prevent N+1 from creeping back in with query-count regression tests.

Recommended for
these people

Who is this course right for?

  • Backend developers with 1–5 years of experience operating services using Spring Data JPA

  • For those who have taken the JPA course and are curious about “what it actually looks like in the database”

  • A developer who has received slow and high-volume query reports from a DBA

Need to know before starting?

  • JPA with an understanding of entities, relationships, lazy loading, and fetch joins

  • SELECT, JOIN, and index concepts

  • Launch a container with Docker, JDK 17 or later.

Hello
This is dorian05202988

Career Verified

A data craftsman with over 20 years of experience in databases and IT. As a DBA and manager of a DB Platform team, I work with database platforms and specialize in MySQL, PostgreSQL, Oracle, MongoDB, SQL tuning, AWS, Terraform, and Python. Drawing on experience in the gaming, finance, and IT services industries, I explain database and cloud architecture. I have published 『Oracle Practical Tuning: Learning SQL Patterns』 and 『Oracle Pro*C Practical Project Guide』, and have presented on serverless architectures, database selection, and multi-database strategies at AWS Summit 2018 and 2019 and DataYa Nolja 2020. Recently, I have been working on slow-query analysis and tuning recommendations using Bedrock LLM, automated DB specification sizing, and query workflows through a DB metadata MCP server and Slack bot. I explain database automation for developers and AI applications for non-developers through hands-on exercises tailored to the audience and objectives of each course. Rather than applying AI suggestions as-is, I teach a decision-making framework that verifies result equivalence, execution plans, and observability conditions, and defers action when the supporting evidence is insufficient. Company operational data and credentials are not included in the course materials.

More

Curriculum

All

70 lectures ∙ (4hr 53min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

dorian05202988's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$123,750.00

25%

$127.60