add performance analysis query

This commit is contained in:
Michael Hoennig 2024-07-31 13:27:28 +02:00
parent cea409c136
commit f9ed2bf0de

View File

@ -111,7 +111,23 @@ time gw-importHostingAssets
### Fetch the Query Statistics
And afterward we can query the statistics in PostgreSQL:
And afterward we can query the statistics in PostgreSQL, e.g.:
```SQL
WITH statements AS (
SELECT * FROM pg_stat_statements pss
)
SELECT calls,
total_exec_time::int/(60*1000) as total_exec_time_mins,
mean_exec_time::int as mean_exec_time_millis,
query
FROM statements
WHERE calls > 100 AND shared_blks_hit > 0
ORDER BY total_exec_time_mins DESC
LIMIT 16;
```
### Reset the Query Statistics
```SQL
SELECT pg_stat_statements_reset();