zalando / pg_view

Get a detailed, real-time view of your PostgreSQL database and system metrics
https://pypi.python.org/pypi/pg-view
Other
496 stars 49 forks source link

Improve pg_stat_activity query #70

Closed CyberDem0n closed 7 years ago

CyberDem0n commented 7 years ago
  1. When joining pg_locks there is no need to consider every single locktype independantly to figure out which rows should be used for join. Join on all possible rows with using 'IS NOT DISTINCT FROM' works the same and easy to read and support.
  2. Query will return unique list of pids in locked_by
  3. For 9.6 use pg_blocking_pids instead of retrieving list of pids from pg_locks. The old technique is too obscure and doesn't really work for parallel queries.

In addition to that reformat all queries to look similar.

avaczi commented 7 years ago

:+1:

LappleApple commented 7 years ago

Hey @alexeyklyukin, just a reminder that this still needs a Zappr approval. Then you can merge.

LappleApple commented 7 years ago

This has branch conflicts. Can we resolve them and merge the PR?

alexeyklyukin commented 7 years ago

All branches will have conflicts after https://github.com/zalando/pg_view/pull/71. I will rebase them as a next step.

LappleApple commented 7 years ago

Danke, @alexeyklyukin

alexeyklyukin commented 7 years ago

Superseded by #92.