Home > Software engineering >  Get table options from query
Get table options from query

Time:07-07

Is there a way to query the options (specifically the autovacuum_vacuum_scale_factor) set for a specific table?

Right now I'm doing \d <table_name> in the CLI to get them, but I'd like to do it from a query.

Thanks :)

CodePudding user response:

CREATE TABLE a_a (
    a int
)
WITH (
    autovacuum_vacuum_scale_factor = 20
);

SELECT
    relname,
    relnamespace,
    reloptions
FROM
    pg_class
WHERE
    relname = 'a_a';

you will get:

 --------- -------------- ------------------------------------- 
| relname | relnamespace |             reloptions              |
 --------- -------------- ------------------------------------- 
| a_a     |        16466 | {autovacuum_vacuum_scale_factor=20} |
 --------- -------------- ------------------------------------- 
  • Related