Re: how to find a pg_toast table's primary table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jerry Sievers <gsievers19(at)comcast(dot)net>
Cc: ProPAAS DBA <dba(at)propaas(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: how to find a pg_toast table's primary table
Date: 2016-12-13 23:46:18
Message-ID: 6624.1481672778@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Jerry Sievers <gsievers19(at)comcast(dot)net> writes:
> ProPAAS DBA <dba(at)propaas(dot)com> writes:
>> pg_toast.pg_toast_16784
>> How do I find the primary table for this toast table?

> Find the pg_class row with reltoastrelid = $oid-of-toast-table.

After you've done that a couple of times, you'll notice that the numeric
part of the toast table's name is the OID of its parent, so really you
just need to do

select '16784'::regclass;

Confirming the reltoastrelid link is a good idea though.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message koffi BADOH 2016-12-14 14:16:44 postgres account disabled . version 9.2
Previous Message Jorge Torralba 2016-12-13 23:40:37 Re: how to find a pg_toast table's primary table