PGSQLTune: Postgresql SQL Tuning Advisor
PGSQLTune is a PostgreSQL extension designed to analyze SQL queries and provide practical recommendations for improvement. Currently, it offers basic suggestions. Our product is under development and will offer many more suggestions in the future.
Click here to download the PGSQLTune plugin .
Setup Instructions
First, extract the downloaded file to a directory:
$ unzip pgsqltune.zip
Then, perform the binary package installation from the Linux terminal as shown below. Since the pg_config tool is required, make sure the directory containing pg_config is included in your PATH variable. The example below adds the binary directory for PostgreSQL version 17 to the PATH. You should adjust this path according to the PostgreSQL version you have installed.
$ cd /path/to/pgsqltune
$ export PATH=$PATH:/usr/pgsql-17/bin/
$ make
$ make USE_PGXS=1 install
After the installation, connect to your database using psql and create the extension:
postgres=# CREATE EXTENSION pgsqltune;
Usage
To use the extension, call the following function with your SQL query:
SELECT pg_sqltune($$ <sql_text> $$);
Example
postgres=# SELECT pg_sqltune($$SELECT * FROM employees WHERE age > 30 AND department = 'Dept 2'$$);
Output:










