Add sqltop

main
Max Ignatenko 2024-02-23 11:19:13 +00:00
parent 0f191b2609
commit ea3e11e495
2 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,9 @@ init-db:
@docker compose stop lister
@cat ./db-migration/init.sql | docker exec -i "$$(docker compose ps --format '{{.Names}}' postgres)" psql -U postgres -d bluesky
sqltop:
watch -n 1 'cat top.sql|docker compose exec -i postgres psql -U postgres -d bluesky'
# ---------------------------- Database ----------------------------

4
top.sql 100644
View File

@ -0,0 +1,4 @@
SELECT pid, age(clock_timestamp(), query_start), state, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' AND state <> 'idle'
ORDER BY query_start asc;