待って。PgHeroさん?
> SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC LIMIT 5;
schemaname | relname | n_live_tup
------------+--------------------+------------
public | pghero_space_stats | 6953
public | schema_migrations | 393
public | conversations | 305
public | statuses | 154
public | settings | 15
(5 rows)
古いの消してもいいのかな…
> SELECT * FROM pghero_space_stats LIMIT 1;
-[ RECORD 1 ]---------------------------
id | 1
database | primary
schema | public
relation | schema_migrations
size | 49152
captured_at | 2021-12-31 00:00:00.018179
変なしがらみは無さそうね…
> \d pghero_space_stats
Table "public.pghero_space_stats"
Column | Type | Collation | Nullable | Default
-------------+-----------------------------+-----------+----------+------------------------------------------------
id | bigint | | not null | nextval('pghero_space_stats_id_seq'::regclass)
database | text | | |
schema | text | | |
relation | text | | |
size | bigint | | |
captured_at | timestamp without time zone | | |
Indexes:
"pghero_space_stats_pkey" PRIMARY KEY, btree (id)
"index_pghero_space_stats_on_database_and_captured_at" btree (database, captured_at)
壊れたらごめんね
> DELETE FROM pghero_space_stats WHERE captured_at < '2022-07-01';
DELETE 1557