forked from andyatkinson/pg_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathper_table_options_reloptions_all_regular_tables.sql
33 lines (30 loc) · 1.36 KB
/
per_table_options_reloptions_all_regular_tables.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-- Credit: ChatGPT
SELECT
nspname AS schema_name,
relname AS table_name,
option_name,
option_value
FROM
pg_class c
JOIN
pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN
LATERAL pg_options_to_table(reloptions) AS opts(option_name, option_value) ON true
WHERE
relkind = 'r' -- Only list options for regular tables
AND nspname NOT IN ('pg_catalog', 'information_schema') -- Exclude system tables
ORDER BY
nspname,
relname;
-- E.g. ALTER TABLE trips SET (autovacuum_vacuum_scale_factor = 0.01);
-- schema_name | table_name | option_name | option_value
-- -------------+----------------------+--------------------------------+--------------
-- rideshare | ar_internal_metadata | |
-- rideshare | locations | |
-- rideshare | schema_migrations | |
-- rideshare | trip_positions | |
-- rideshare | trip_requests | |
-- rideshare | trips | autovacuum_vacuum_scale_factor | 0.01
-- rideshare | users | autovacuum_enabled | false
-- rideshare | vehicle_reservations | |
-- rideshare | vehicles | |