NikolayS / plan-exporter

Query plan exporter for psql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Query plan exporter

Build Status License Go Report

The utility receives Postgres Query Plans from psql and sends them to a visualizer for sharing. It will compute and highlight the most important information to make them easier to understand.

Installation

Precompiled binary

It's highly recommended installing a specific version of the plan-exporter available on the releases page.

To download and decompress the binary, use an example:

wget https://github.com/agneum/plan-exporter/releases/download/v0.0.3/plan-exporter-0.0.3-linux-amd64.tar.gz
tar -zxvf plan-exporter-0.0.3-linux-amd64.tar.gz
sudo mv plan-exporter /usr/local/bin/

Build from sources

Version 1.13+ is required.

git clone git@github.com:agneum/plan-exporter.git
cd plan-exporter
go install github.com/agneum/plan-exporter

On default, make install puts the compiled binary in go/bin.

Usage

  1. Run psql

  2. Set up output to the query plan exporter:

    postgres=# \o | plan-exporter
  3. Run explain query:

    postgres=# explain select 1;
    postgres=# 
                          QUERY PLAN                      
    ------------------------------------------------------
     Seq Scan on hypo  (cost=0.00..180.00 rows=1 width=0)
       Filter: (id = 1)
    (2 rows)
    
    Do you want to post this plan to the visualizer?
    Send '\qecho Y' to confirm
  4. Confirm of posting the plan to the visualizer: \qecho Y

    postgres=# \qecho Y
    postgres=# Posting to the visualizer...

    That's it! Receive the link!

    The plan has been posted successfully.
    URL: https://explain.depesz.com/s/XXX
    postgres=#

Command-Line Options

Contact Information

Follow the news and releases on twitter.

About

Query plan exporter for psql

License:MIT License


Languages

Language:Go 89.3%Language:Makefile 10.7%