Add sqltop
This commit is contained in:
parent
0f191b2609
commit
ea3e11e495
2 changed files with 7 additions and 0 deletions
3
Makefile
3
Makefile
|
@ -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
Normal file
4
top.sql
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue