Thread: Reading storage parameters

Reading storage parameters

From
Daniele Varrazzo
Date:
Hello,

is there a way to read the storage parameters values set on a table
(i.e. what set with ALTER TABLE foo SET (autovacuum_enabled=false) and
so on...)? I can't find it in the docs.

-- Daniele

Re: Reading storage parameters

From
Thom Brown
Date:
On 21 June 2012 13:12, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
> Hello,
>
> is there a way to read the storage parameters values set on a table
> (i.e. what set with ALTER TABLE foo SET (autovacuum_enabled=false) and
> so on...)? I can't find it in the docs.

SELECT c.reloptions
FROM pg_class c
INNER JOIN pg_namespace n
  ON c.relnamespace = n.oid
WHERE c.relname = 'tablename'
AND n.nspname = 'schemaname';

--
Thom

Re: Reading storage parameters

From
Raghavendra
Date:
On Thu, Jun 21, 2012 at 5:42 PM, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
Hello,

is there a way to read the storage parameters values set on a table
(i.e. what set with ALTER TABLE foo SET (autovacuum_enabled=false) and
so on...)? I can't find it in the docs.


One way is with 

\d+ <tablename>

Second with pg_class.

postgres=# select relname,reloptions from pg_class where relname='foo';
 relname |         reloptions
---------+----------------------------
 foo  | {autovacuum_enabled=false}
(1 row)


---
Regards,
Raghavendra
EnterpriseDB Corporation

Re: Reading storage parameters

From
Daniele Varrazzo
Date:
On Thu, Jun 21, 2012 at 1:26 PM, Thom Brown <thom@linux.com> wrote:
> On 21 June 2012 13:12, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
>> Hello,
>>
>> is there a way to read the storage parameters values set on a table
>> (i.e. what set with ALTER TABLE foo SET (autovacuum_enabled=false) and
>> so on...)? I can't find it in the docs.
>
> SELECT c.reloptions
> FROM pg_class c
> INNER JOIN pg_namespace n
>  ON c.relnamespace = n.oid
> WHERE c.relname = 'tablename'
> AND n.nspname = 'schemaname';

Ok, so they are in pg_class.reloptions, thank you!

-- Daniele