Configuring SQL Profiler¶
The SQL Profiler plugin is not automatically enabled when the installation process completes. This allows you to restart the server at a convenient time, and prevents the plugin from being loaded unnecessarily on systems where it is not required on a continual basis.
Use the following steps to enable the plugin for each database monitored by SQL Profiler:
- Edit the
postgresql.conffile on the server you wish to profile, modifying the
shared_preload_librariesconfiguration parameter as shown below:
shared_preload_libraries = '$libdir/sql-profiler'
shared_preload_libraries = '$libdir/sql-profiler.dll'
- Create the functions used by SQL Profiler in your database. The SQL Profiler installation program places a SQL script (named
sql-profiler.sql) in the
share/contribsubdirectory of the main PostgreSQL installation directory. You must invoke this script on the maintenance database (specified when registering the server with PEM).
You can also use the psql command line to invoke the configuration script. The following command uses psql to invoke the sql-profiler.sql script on PostgreSQL Server database on a Linux system:
$ /usr/pgsql-x/bin/psql -U postgres postgres -f /usr/pgsql-x/share/contrib/sql-profiler.sql
- Stop and re-start the server for the changes to take effect.
Please note: if you have 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.