Advanced SQL for Query Tuning and Performance Optimization

Learn to tune PostgreSQL queries and fix slow SQL

Duration 2h 9m Rating (4.6) Price Included with subscription on LinkedIn Learning
Created by Dan Sullivan
Last updated 2023-10-11
Platform: LinkedIn Learning Topic: Databases Skills: PostgreSQL Query Optimization

Advanced SQL for Query Tuning and Performance Optimization is a practitioner-focused course that shows how to make SQL workloads faster and more efficient by interpreting execution plans and applying targeted changes in PostgreSQL. It centers on practical query tuning techniques such as index selection, join strategy, partitioning, and materialized views to reduce CPU, memory, and I/O costs.

Geared toward technicians who already write SQL, the course translates optimizer concepts into repeatable diagnostics and fixes using tools like EXPLAIN/ANALYZE and pg_stat_statements. By the end, learners should be able to analyze slow queries, implement appropriate indexes and partitions, and apply PostgreSQL-specific tuning workflows to improve real-world query performance.

At a Glance

Advanced SQL for Query Tuning and Performance Optimization is a focused LinkedIn Learning course taught by Dan Sullivan that demonstrates how to analyze execution plans and apply practical tuning techniques. The course covers execution plans, index types, join methods, partitioning, materialized views, and PostgreSQL tuning tools to reduce query CPU and memory use.

Level Advanced
Rating 4.6 out of 5
Duration 2+ hours
Languages English
Certificate Certificate of completion (sharable)
Access Access for as long as your LinkedIn Learning subscription is active (1-month free trial available)
Course includes
  • 8 quizzes
  • Test-your-knowledge assessments
  • Offline viewing via LinkedIn Learning mobile app
Price Included with LinkedIn Learning subscription (subscription-based, monthly or annual plans)

What This Course Teaches

The course frames outcomes as practical, measurable competencies you can use to diagnose and reduce SQL query cost across real PostgreSQL workloads. Learners will leave able to analyze execution plans, apply index and partitioning strategies, optimize joins, and use PostgreSQL tooling to identify and fix slow queries.

Execution Plans
Analyze and interpret SQL execution plans to identify expensive operations and optimization opportunities.
Index Tuning
Design and apply appropriate index types to reduce I/O and improve query selectivity.
Join Optimization
Compare and implement nested loop, hash, and merge join strategies to minimize join cost.
Partitioning
Choose and implement range, list, or hash partitioning schemes to limit scan scopes and improve performance.
Materialized Views
Create and refresh materialized views to precompute results and speed up repeated queries.
PostgreSQL Tools
Use EXPLAIN/ANALYZE, pg_stat_statements, and auto_explain to profile and diagnose problematic queries.
Statistics & Monitoring
Collect and analyze table and schema statistics to inform optimizer choices and track regressions.
Advanced Techniques
Apply CTEs, optimizer hints, parallel execution, and caching strategies to fine‑tune query performance.

How the Course Is Structured

The course is organized as a sequence of short, focused video lessons grouped into eight technical modules plus introductory and concluding sections. In total it contains 65 individual lessons and runs approximately 2+ hours overall.

Curriculum overview

01Introduction

Opening remarks and orientation to the course goals and scope.

02Reduce query response time with query tuning49s

Introduces the motivation for tuning queries and common performance symptoms.

03What you should know56s

Pre-course assumptions and prerequisite knowledge expected of learners.

04From declarative SQL to a procedural execution plan3m 3s

Explains how the SQL optimizer transforms declarative queries into executable plans.

05Scanning tables and indexes3m 6s

Covers how table and index scans operate and their cost implications.

06Joining tables2m 23s

Overview of join processing and factors that influence join performance.

07Partitioning data2m 23s

Introduces partitioning concepts and why partitioning can reduce query scope.

08Challenge: Choosing how to partition a table30s

A short applied exercise prompting selection of an appropriate partitioning strategy.

09Solution: Choosing how to partition a table40s

Instructor walkthrough that explains the recommended partitioning choice.

10Using PostgreSQL in Codespaces2m 33s

Demonstrates how to run PostgreSQL within GitHub Codespaces for hands-on practice.

11Explain and analyze3m 25s

Shows how to use EXPLAIN and ANALYZE to reveal execution plan details and costs.

12Example plan: Selecting with a WHERE clause2m 26s

Walks through an example execution plan for a filtered SELECT statement.

13Indexes2m 43s

Introduces index concepts and how indexes influence plan selection.

14Challenge: Generating a query execution plan31s

A brief task to produce and inspect an execution plan yourself.

15Solution: Generating a query execution plan21s

Instructor solution showing the expected plan output and interpretation tips.

16Indexing3m 16s

Explains core indexing principles and when to add indexes to tables.

17B-tree indexes2m 21s

Covers B-tree index behavior and typical use cases for ordered lookups.

18B-tree index example plan4m 44s

Detailed example showing how a B-tree index appears in an execution plan.

19Bitmap indexes1m 40s

Introduces bitmap indexing concepts and scenarios where they help.

20Bitmap index example plan3m 6s

Example plan illustrating bitmap index usage and cost trade-offs.

21Hash indexes1m 19s

Explains hash index characteristics and limitations.

22Hash index example plan2m 53s

Shows an execution plan example where hash indexing is applied.

23Bloom filter indexes6m 32s

Discusses bloom filters and their use in probabilistic indexing strategies.

24PostgreSQL-specific indexes1m 54s

Highlights index types and extensions unique to PostgreSQL.

25Challenge: Choosing an index31s

Short exercise asking learners to select the best index for a query pattern.

26Solution: Choosing an index37s

Instructor explanation of the chosen index and rationale.

27Types of joins2m 36s

Introduces the join algorithms the optimizer may choose for combining rows.

28Nested loops3m 19s

Describes nested loop join mechanics and when they are efficient.

29Nested loop example plan3m 59s

Example demonstrating a nested loop in a real plan and its cost profile.

30Hash joins1m 29s

Covers hash join behavior and memory considerations.

31Hash join example plan1m 54s

Walks through a plan that uses a hash join and how to interpret it.

32Merge joins2m 23s

Explains merge join prerequisites and performance characteristics.

33Merge join example3m 2s

Example demonstrating merge join behavior in an execution plan.

34Subqueries vs. joins1m 13s

Compares performance trade-offs between subqueries and equivalent joins.

35Challenge: Designing a join24s

A short task to design a join strategy for a given query pattern.

36Solution: Designing a join22s

Instructor-provided solution and reasoning for the join design challenge.

37Horizontal vs. vertical partitioning2m 47s

Compares partitioning approaches and their impact on query patterns.

38Partition by range1m 40s

Introduces range partitioning and typical scenarios for its use.

39Partition by range example5m 36s

Walks through a concrete range partitioning example and effects on plans.

40Partition by list1m 27s

Explains list-based partitioning and when to apply it.

41Partition by list example5m 37s

Example showing list partition implementation and query effects.

42Partition by hash1m 55s

Covers hash partitioning mechanics and typical use cases.

43Partition by hash example4m 35s

Demonstrates a hash partition example and its performance implications.

44Challenge: Partitioning a table36s

A brief exercise to choose an appropriate partitioning approach for a schema.

45Solution: Partitioning a table28s

Instructor solution showing recommended partition boundaries and rationale.

46Materialized views1m 41s

Introduces materialized views as a technique for precomputing expensive results.

47Creating materialized views1m 58s

Shows how to define materialized views in SQL and choose refresh strategies.

48Refreshing materialized views2m

Discusses refresh options and trade-offs between freshness and cost.

49Challenge: Creating a materialized view43s

A practical task to define and refresh a materialized view for a sample query.

50Solution: Creating a materialized view29s

Instructor walkthrough of the materialized view exercise and expected results.

51Collect statistics about data in tables3m 21s

Covers how table statistics are gathered and why they matter to the optimizer.

52Analyzing execution statistics with pg_stat_statements1m 54s

Demonstrates using pg_stat_statements to find frequently run or costly queries.

53Reviewing execution plans with the auto_explain module2m 34s

Shows how auto_explain can automatically capture slow plans for offline analysis.

54Additional analysis with other pg_stats data1m 26s

Explores other pg_stats sources to supplement optimizer decision-making.

55Challenge: Analyze schema statistics23s

An exercise to apply statistics analysis to detect schema-level issues.

56Solution: Analyze schema statistics16s

Instructor solution showing how statistics reveal optimization opportunities.

57Using common table expressions to avoid repetitive computation2m 11s

Shows how CTEs can reduce repeated work and when they help or hurt performance.

58Hints to the Query Optimizer1m 43s

Discusses explicit hints and their limited role in guiding the optimizer.

59Parallel query execution2m 6s

Introduces parallel execution and factors that enable or limit parallelism.

60Improving cache utilization2m 20s

Covers strategies to increase effective caching and reduce disk I/O.

61Miscellaneous tips2m 21s

A collection of practical, miscellaneous tuning tips and heuristics.

62Challenge: Design a common table expression24s

Exercise to design a CTE that avoids redundant computation in a sample query.

63Solution: Design a common table expression18s

Instructor walk-through showing an efficient CTE implementation.

64Conclusion

Final reflections, recommended next steps, and summary advice for continued tuning work.

65Next steps1m 4s

Guidance on how to continue practicing and applying the techniques demonstrated in the course.

Audience & Requirements

The course targets technical practitioners who must diagnose and reduce SQL query cost in production systems. It is best suited to data engineers, DBAs, and backend developers who already write SQL and need practical PostgreSQL-focused tuning techniques.

Who It’s For
  • Data engineers and ETL engineers responsible for pipeline performance.
  • Database administrators managing query performance and capacity.
  • Backend developers troubleshooting slow application queries.
  • BI engineers and analysts who optimize report and aggregation queries.
What You’ll Need
  • Working knowledge of SQL (joins, aggregations, subqueries).
  • Familiarity with relational database concepts such as indexes and schemas.
  • Access to PostgreSQL (the course demonstrates using GitHub Codespaces; an equivalent PostgreSQL environment is acceptable).

Final Verdict

For professionals responsible for production query performance, this course is a practical, efficient way to acquire targeted tuning techniques. Given its strong user rating, concise runtime, and inclusion on a subscription-based professional learning platform that awards a sharable completion certificate, it delivers high practical value for a modest time investment.

It is best suited to practitioners who already write SQL and need actionable diagnostics and fixes rather than a general introduction; complete beginners should prepare with foundational SQL study first. If you already use the platform, this course is an economical, low-friction way to upskill; if you don’t, consider whether a short subscription or a more lab-heavy offering better fits a longer practice-oriented learning plan.