Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need PG slow queries in the last several days, not currently #3

Open
mariusa opened this issue Jun 28, 2023 · 0 comments
Open

need PG slow queries in the last several days, not currently #3

mariusa opened this issue Jun 28, 2023 · 0 comments

Comments

@mariusa
Copy link

mariusa commented Jun 28, 2023

https://github.com/HariSekhon/SQL-scripts/blob/54cc9cef687ba3a242688866b6af76956f23865c/postgres_queries_slow.sql#L16C5-L16C71

eg


SELECT interval '1 millisecond' * total_exec_time AS total_exec_time,
to_char((total_exec_time/sum(total_exec_time) OVER()) * 100, 'FM90D0') || '%'  AS prop_exec_time,
to_char(calls, 'FM999G999G999G990') AS ncalls,
interval '1 millisecond' * (blk_read_time + blk_write_time) AS sync_io_time,
query
FROM pg_stat_statements WHERE userid = (SELECT usesysid FROM pg_user WHERE usename = current_user LIMIT 1)
ORDER BY total_exec_time DESC
LIMIT 10;
SELECT pg_stat_statements_reset();


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant