After 90 min: Ability to extract, filter, and analyze data from a real database
Optimize Complex SQL Queries
After 90 min: Dramatically faster query execution and reduced database load
SQL query optimization is where database work becomes performance engineering. A query that runs in 200 milliseconds on a test dataset can take twelve seconds on production data — not because the query is wrong, but because it's unaware of the data distribution, index landscape, and query planner behavior that determines actual execution. This advanced plan teaches the diagnostic and optimization skills that close that gap.
The session covers profiling queries with EXPLAIN ANALYZE to see actual execution plans rather than guessing (the most important diagnostic tool — you cannot optimize what you haven't measured), creating targeted indexes that support specific query patterns without the overhead of over-indexing, rewriting subqueries and correlated queries as joins when the planner struggles with them, implementing result caching for expensive frequently-run queries, and establishing a performance monitoring baseline. Each optimization is measured before and after.
The warning against over-indexing is practical and consequential. Indexes speed read queries but slow write operations — every INSERT, UPDATE, and DELETE must maintain every index on the table. A table with thirty indexes on it writes dramatically slower than one with five carefully chosen indexes. The optimization mindset is surgical: add indexes for specific measured bottlenecks, not speculatively for queries that might run someday.
What you need
The 90-Minute Plan
Use EXPLAIN PLAN to understand query execution. Identify slow queries.
Build indexes on frequently searched columns and joins.
Optimize joins, subqueries, and aggregations. Use window functions.
Cache frequent queries. Use materialized views for complex aggregations.
Monitor improvements. Document optimizations. Next: explore partitioning.
Measure before and after. Small improvements at scale matter. Don't over-index.
You might also try
After 90 min: A properly structured database for a real application or business problem
After 90 min: A reusable library of UI components for your projects and team
After 90 min: A scalable microservices architecture for a distributed application