Installing SQL Profiler¶
SQL Profiler allows a database superuser to locate and optimize poorly-running SQL code. Users of Microsoft SQL Server’s Profiler will find PEM’s SQL Profiler very similar in operation and capabilities. You must install and enable the SQL Profiler extension on each server on which you want to use it. For example, if you have a host running PostgreSQL 14 and PostgreSQL 15, you must enable the extension on each server.
SQL Profiler is supported on the same platforms as the Postgres distribution you’re using. Support for the SQL Profiler extension starts with version 11 for PostgreSQL and EDB Postgres Advanced Server and version 12 for EDB Postgres Extended. See: - EDB Postgres Advanced Server Product Compatibility - Postgres Product Compatibility - EDB Postgres Extended Server Product Compatibility
Installing the SQL Profiler¶
Prerequisites¶
Before you begin the installation process:
Install Postgres. See:
Set up the repository.
Setting up the repository is a one-time task. If you have already set up your repository, you don’t need to perform this step.
To set up the repository, go to EDB repositories and follow the instructions provided there.
Install the SQL Profiler package on Linux¶
The syntax for the install command is:
sudo <package-manager> -y install edb-<postgres><postgres_version>-server-sqlprofiler
Where:
<pacakge-manager>is the package manager used with your operating system:Package manager | Operating system |————— | ——————————– |dnf | RHEL 8 and derivatives |yum | RHEL 7 and derivatives, CentOS 7 |zypper | SLES |apt-get | Debian and derivatives |<postgres>is the distribution of Postgres you’re using:Postgres distribution | Value |—————————- | ———- |PostgreSQL | pg |EDB Postgres Advanced Server | as |EDB Postgres Extended | postgresextended |<postgres_version>is the version of Postgres you’re using.
For example, to install the latest version of SQL Profiler for EDB Postgres Advanced Server 15 on a RHEL 8 platform:
sudo dnf -y install edb-as15-server-sqlprofiler
Install the SQL Profiler on Windows¶
You can use the graphical installer to install any version of SQL Profiler on Windows platform.
To invoke the SQL Profiler graphical installer, assume superuser privileges (or
Administrator privileges on Windows), navigate into the directory that
contains the installer, and invoke the installer:
sqlprofiler-pg-<pg_version>-<sql_profiler_version>-windows-x64.exe
Where, pg_version is the version of your PostgreSQL and sql_profiler_version is the version of SQL Profiler.
The SQL Profiler installer welcomes you to the Setup Wizard.
The SQL Profiler Installer - Welcome dialog¶
Click Next to continue to the License Agreement.
The SQL Profiler Installer - License Agreement¶
Carefully review the license agreement before highlighting the
appropriate radio button and accepting the agreement; click Next to
continue to the Installation Directory dialog.
The PostgreSQL Installer - Installation Directory¶
Specify an alternate location for the installation directory, or accept
the default location and click Next to continue.
The PostgreSQL Installer - Ready to Install¶
The wizard is now ready to install the SQL Profiler plugin. Click Next to continue.
The PostgreSQL Installer - Installation in Progress¶
The SQL Profiler plugin installer displays progress bars as it copies files to your system.
The SQL Profiler Installer - Finish¶
When the installation is complete, the SQL Profiler plugin is ready to be configured.
Enabling the extension¶
To enable the extension:
Edit the
postgresql.conffile on the server you want to profile, modifying theshared_preload_librariesparameter:shared_preload_libraries = '$libdir/sql-profiler'
Restart the Postgres server.
Create the SQL Profiler extension in your maintenance database with the following command:
`` psql -d postgres - U enterprisedb CREATE EXTENSION sql_profiler; ``
Note
If you are connected to the PEM server with the PEM client before configuring SQL Profiler, you must disconnect and reconnect with the server to enable SQL Profiler functionality.
After enabling the extension, SQL Profiler is ready to use with all databases that reside on the server.