add performance analysis query
This commit is contained in:
parent
cea409c136
commit
f9ed2bf0de
@ -111,7 +111,23 @@ time gw-importHostingAssets
|
|||||||
|
|
||||||
### Fetch the Query Statistics
|
### 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
|
```SQL
|
||||||
SELECT pg_stat_statements_reset();
|
SELECT pg_stat_statements_reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user