Step 1: Enable log_explain

In order to use log-based EXPLAIN, you must have integrated Log Insights successfully.

Once Log Insights is working, enabling EXPLAIN plan collection just requires turning on the collector setting. You can do this by first stopping the running Postgres Container App for the collector:

postgres=# SELECT list_containers();
                                                      list_containers
----------------------------------------------------------------------------------------------------------------------------
 CONTAINER ID  IMAGE                               COMMAND     CREATED         STATUS             PORTS       NAMES
 c90e8cf8a3ea  quay.io/pganalyze/collector:stable  collector   54 minutes ago  Up 54 minutes ago              elegant_turing
(1 row)

postgres=# SELECT stop_container('elegant_turing');
 stop_container 
----------------
 elegant_turing
(1 row)

And then starting it again with the PGA_ENABLE_LOG_EXPLAIN setting turned on, whilst making sure you set the correct DB_URL:

SELECT run_container('-d -t -e DB_URL="REPLACE_ME" -e PGA_API_KEY="API_KEY" -e PGA_ENABLE_LOG_EXPLAIN=true quay.io/pganalyze/collector:stable');
Proceed to Step 3: Test and verify

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →