15 lines
1.5 KiB
SQL
15 lines
1.5 KiB
SQL
CREATE TABLE IF NOT EXISTS public.c77_dbh_vacuum_stats (
|
|
table_name text COLLATE pg_catalog."default" PRIMARY KEY, -- Fully qualified table name (schema.table)
|
|
last_vacuum timestamp without time zone, -- Last manual vacuum
|
|
last_autovacuum timestamp without time zone, -- Last autovacuum
|
|
vacuum_count bigint DEFAULT 0, -- Number of vacuums
|
|
dead_tuples bigint DEFAULT 0, -- Estimated dead tuples
|
|
live_tuples bigint DEFAULT 0, -- Estimated live tuples
|
|
table_size bigint DEFAULT 0, -- Table size in bytes
|
|
bloat_estimate numeric DEFAULT 0, -- Estimated bloat percentage
|
|
last_updated timestamp without time zone DEFAULT now() -- Last stats update
|
|
);
|
|
|
|
REVOKE ALL ON TABLE public.c77_dbh_vacuum_stats FROM PUBLIC;
|
|
GRANT SELECT ON TABLE public.c77_dbh_vacuum_stats TO PUBLIC;
|
|
GRANT ALL ON TABLE public.c77_dbh_vacuum_stats TO homestead; -- Adjust role as needed |