TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to Find and Stop Running Queries on PostgreSQL

125 pointsby j4miealmost 3 years ago

7 comments

superb-owlalmost 3 years ago
This process has saved me from an outage more than once.<p>I keep a dashboard of running pids, and get alerts when any of them take more than N minutes (excepting autovacuum). Once every few months I have to psql into prod and cancel one.
评论 #31817280 未加载
评论 #31816277 未加载
unnouinceputalmost 3 years ago
Quote: &quot;Windows does not have a kill command...&quot;<p>Yes, she does. It&#x27;s called &quot;taskkill&quot;
评论 #31819682 未加载
评论 #31819652 未加载
natmakaalmost 3 years ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;dalibo&#x2F;pg_activity" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dalibo&#x2F;pg_activity</a> (&#x27;a top-like application for PostgreSQL server activity monitoring&#x27;) is quite useful.
faizshahalmost 3 years ago
This is really nice, are there any preventative measures one could take as well? For example setting a max query run time or something like that?
评论 #31819018 未加载
aidosalmost 3 years ago
Ooohh. That pg_blocking_pids(blockedpid) function is a nice one to add to the arsenal.
SnowHill9902almost 3 years ago
How can you find and stop users which are accessing a certain table?
评论 #31817985 未加载
devoutsalsaalmost 3 years ago
There’s always “sudo reboot”, too :)