You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article describes how to optimize query statistics collection on an Azure Database for PostgreSQL flexible server instance.
16
+
This article describes how to optimize query statistics collection on an Azure Database for PostgreSQL flexible server using pg_stat_statements extension
18
17
19
18
## Use pg_stat_statements
20
19
21
20
**Pg_stat_statements** is a PostgreSQL extension that can be enabled in Azure Database for PostgreSQL flexible server. The extension provides a means to track execution statistics for all SQL statements executed by a server. This module hooks into every query execution and comes with a non-trivial performance cost. Enabling **pg_stat_statements** forces query text writes to files on disk.
22
21
23
-
If you have unique queries with long query text or you don't actively monitor **pg_stat_statements**, disable **pg_stat_statements** for best performance. To do so, change the setting to `pg_stat_statements.track = NONE`.
22
+
> [!NOTE]
23
+
> `pg_stat_statements.track` is by default to NONE (i.e. disabled).
24
24
25
-
To set `pg_stat_statements.track = NONE`:
25
+
If you want to start tracking the execution statistics of all SQL statements executed by a server, then enable **pg_stat_statements**. To do so, set the value to `TOP` or `ALL`, depending on whether you want to track top-level queries or also nested queries (those executed inside a function or procedure).
26
+
27
+
To set **pg_stat_statements.track** = `TOP`
26
28
27
29
- In the Azure portal, go to the [Azure Database for PostgreSQL flexible server resource management page and select the server parameters blade](concepts-server-parameters.md).
28
-
- Use the [Azure CLI](connect-azure-cli.md) az postgres server configuration set to `--name pg_stat_statements.track --resource-group myresourcegroup --server mydemoserver --value NONE`.
30
+
- Use the [Azure CLI](connect-azure-cli.md) az postgres server configuration set to `--name pg_stat_statements.track --resource-group myresourcegroup --server mydemoserver --value TOP`.
0 commit comments