Conference Schedule - PGCon 2020

Seamless SQL optimization

Date: 2020-05-26
Time: 14:00–16:00
Room: Stream 1
Level: Intermediate

There are two types of analysis and optimization.

The first, macro-analysis, is analyzing the workload as a whole. Usually, it is done using pg_stat_statements or pgBadger

The second one is micro-analysis and the central tool here is the EXPLAIN command.

And there is a huge gap between them, partially covered by auto_explain and pg_qualstats extensions.

In this tutorial, we learn how to establish a smooth and seamless SQL optimization process in your organization? Topics we'll cover:

  1. What are the pros and cons of using pg_stat_statements compared to log analysis performed by pgBadger?

  2. What are the key metrics in macro-analysis and how to choose the most applicable in each case (is it total time consumed by an SQL query group? or average timing, or maybe shared buffers hit and read by the query group per second?);

  3. Closing the gap: how to switch from macro-analysis to micro-analysis (you identified a "bad" SQL group, how to start optimizing it and what is needed to make this process faster / more automated?).

  4. How to simplify the process of adaption of using EXPLAIN command by a wide range of backend developers, what metrics matter and how (timing vs buffers involved).

  5. EXPLAIN visualization technics and their pros and cons (explain.depesz.com, PEV, and explain.dalibo.com, explain.tensor.ru, FlameGraphs for EXPLAIN).

  6. How to accumulate knowledge about SQL optimization, share it with teammates and improve collaboration.

Video

Slides

The following slides have been made available for this session:

Speaker

Nikolay Samokhvalov