Add sqldu
This commit is contained in:
parent
ea3e11e495
commit
13b911615d
2 changed files with 18 additions and 0 deletions
3
Makefile
3
Makefile
|
@ -48,6 +48,9 @@ init-db:
|
||||||
sqltop:
|
sqltop:
|
||||||
watch -n 1 'cat top.sql|docker compose exec -i postgres psql -U postgres -d bluesky'
|
watch -n 1 'cat top.sql|docker compose exec -i postgres psql -U postgres -d bluesky'
|
||||||
|
|
||||||
|
sqldu:
|
||||||
|
cat du.sql | docker compose exec -iT postgres psql -U postgres -d bluesky
|
||||||
|
|
||||||
# ---------------------------- Database ----------------------------
|
# ---------------------------- Database ----------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
15
du.sql
Normal file
15
du.sql
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
SELECT
|
||||||
|
relname as table_name,
|
||||||
|
pg_size_pretty(pg_total_relation_size(relid)) As "Total Size",
|
||||||
|
pg_size_pretty(pg_indexes_size(relid)) as "Index Size",
|
||||||
|
pg_size_pretty(pg_table_size(relid)) as "Actual Size"
|
||||||
|
FROM pg_catalog.pg_statio_user_tables
|
||||||
|
ORDER BY pg_total_relation_size(relid) DESC;
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
relname as table_name,
|
||||||
|
indexrelname as index_name,
|
||||||
|
pg_size_pretty(pg_table_size(indexrelid)) as "Index Size"
|
||||||
|
FROM pg_catalog.pg_statio_user_indexes
|
||||||
|
ORDER BY pg_table_size(indexrelid) DESC;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue