CREATE SCHEMA bluemedora ĬREATE EXTENSION IF NOT EXISTS pg_stat_statements ĬREATE OR REPLACE FUNCTION bluemedora.pg_stat_statements() RETURNS SETOF pg_stat_statements AS If you're monitoring multiple databases, run the script on the postgres database. To help automate the creation of a least-privileged user (LPU) for your PostgreSQL instance, run the following script on the database you plan to monitor. WHERE name = ‘pg_stat_statements’ AND installed_version IS NOT NULL Creating a Least-Privileged User (LPU) You can check if it is installed on the database by calling: The extension is database bound and must be created for each database, even though it pulls data from each:ĬREATE EXTENSION IF NOT EXISTS pg_stat_statements You also need to create the extension in the database. Shared_preload_libraries = ‘pg_stat_statements’ Query Tracking: To track queries, these settings need to be added to the shared_preload_libraries settings: See: Creating a Least-Privileged User (LPU).įunction Tracking: To track functions, ‘pg_stat_user_functions’ requires the log_statement_stats field to be modified (in nf) to allow for any function tracking to happen. However, using our defined LPU script will allow you to bypass assigning the "super user" attribute. Tablespace data also requires an administrative-level monitoring user. An “insufficient privileges” error will be returned in the Query text field if a read-only user is used. Note: *NOTE: For security, an administrative-level monitoring user (i.e., “super user”) is required to view the SQL text or queryid of queries executed by other users.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |