

plan_format is set to text to control the format of the execution plan to be in an ordinary text representation.This is similar to the pg_stat_statements track parameter. track is set to all to track top-level statements and nested statements.max is set to 1000 to determine the maximum number of plans tracked by pg_store_plans.This may be useful in some systems to prevent the overhead of repeatedly reading the system clock. log_timing is set to false to disable recording the actual timings.log_analyze is set to false to only return the EXPLAIN output, not the EXPLAIN ANALYZE output.
POSTGRES QUERY PLAN INSTALL
Then install the server dev for your installed PostgreSQL version through the following command on your terminal:Ī breakdown of these parameters is as follows: This tutorial demonstrates using PostgreSQL version 12 but feel free to use your desired version. First, make sure you’ve installed PostgreSQL. Afterwards, we will get insights about what Datasentinel can provide based on this extension and how visualizations will make it easy for developers to track such useful metric.īecause this extension is developed by the community, it’s not built-in in PostgreSQL so we need to set it up. We will then join it with the pg_stat_statements extension and see how powerful both tools can help use boost PostgreSQL performance.
POSTGRES QUERY PLAN HOW TO
We will start by setting up the pg_store_plans module and learn how to benefit from this third-party tool. This makes it easy for developers to identify any issues with their queries or to optimize them for better performance. The pg_store_plans PostgreSQL extension is a PostgreSQL extension that allows users to store their query execution plans in an easily accessible form. In this tutorial, we will discuss how to track PostgreSQL execution plans run by the server optimizer with the pg_store_plans module, an extension created by the PostgreSQL community. In an earlier tutorial discussing pg_stat_statements extension, we learned how to track PostgreSQL queries.

Tracking PostgreSQL execution plans is an important metric for enhancing PostgreSQL performance. How to Track PostgreSQL Execution Plans using pg_store_plans Extension
