The optimiser costs plans from statistics, not from the data. After a bulk load or a schema change those statistics are wrong, and it will confidently pick a nested loop over a million rows. EXPLAIN ANALYZE shows estimated against actual side by side.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-25