pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to find a pg_toast table's primary table
5+ messages / 5 participants
[nested] [flat]

* how to find a pg_toast table's primary table
@ 2016-12-13 23:24  ProPAAS DBA <dba@propaas.com>
  0 siblings, 3 replies; 5+ messages in thread

From: ProPAAS DBA @ 2016-12-13 23:24 UTC (permalink / raw)
  To: pgsql-admin

Hi all;


I'm seeing this table as the most vacuumed table:


pg_toast.pg_toast_16784

How do I find the primary table for this toast table?



Thanks in advance



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to find a pg_toast table's primary table
@ 2016-12-13 23:33  Joshua D. Drake <jd@commandprompt.com>
  parent: ProPAAS DBA <dba@propaas.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Joshua D. Drake @ 2016-12-13 23:33 UTC (permalink / raw)
  To: ProPAAS DBA <dba@propaas.com>; pgsql-admin

On 12/13/2016 03:24 PM, ProPAAS DBA wrote:
> Hi all;
>
>
> I'm seeing this table as the most vacuumed table:
>
>
> pg_toast.pg_toast_16784
>
> How do I find the primary table for this toast table?

Within the database:

select oid::regclass from pg_class where reltoastrelid='16784'::regclass;

JD;

-- 
Command Prompt, Inc.                  http://the.postgres.company/
                         +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to find a pg_toast table's primary table
@ 2016-12-13 23:39  Jerry Sievers <gsievers19@comcast.net>
  parent: ProPAAS DBA <dba@propaas.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Jerry Sievers @ 2016-12-13 23:39 UTC (permalink / raw)
  To: ProPAAS DBA <dba@propaas.com>; +Cc: pgsql-admin

ProPAAS DBA <dba@propaas.com> writes:

> Hi all;
>
>
> I'm seeing this table as the most vacuumed table:
>
>
> 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.

HTH

>
>
>
> Thanks in advance

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to find a pg_toast table's primary table
@ 2016-12-13 23:40  Jorge Torralba <jorge.torralba@gmail.com>
  parent: ProPAAS DBA <dba@propaas.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Jorge Torralba @ 2016-12-13 23:40 UTC (permalink / raw)
  To: ProPAAS DBA <dba@propaas.com>; +Cc: pgsql-admin

select relname from pg_class where reltoastrelid = ( select oid from
pg_class where relname = 'toast_table_name' );

On Tue, Dec 13, 2016 at 3:24 PM, ProPAAS DBA <dba@propaas.com> wrote:

> Hi all;
>
>
> I'm seeing this table as the most vacuumed table:
>
>
> pg_toast.pg_toast_16784
>
> How do I find the primary table for this toast table?
>
>
>
> Thanks in advance
>
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>



-- 
Thanks,

Jorge Torralba
----------------------------

Note: This communication may contain privileged or other confidential
information. If you are not the intended recipient, please do not print,
copy, retransmit, disseminate or otherwise use the information. Please
indicate to the sender that you have received this email in error and
delete the copy you received. Thank You.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: how to find a pg_toast table's primary table
@ 2016-12-13 23:46  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jerry Sievers <gsievers19@comcast.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2016-12-13 23:46 UTC (permalink / raw)
  To: Jerry Sievers <gsievers19@comcast.net>; +Cc: ProPAAS DBA <dba@propaas.com>; pgsql-admin

Jerry Sievers <gsievers19@comcast.net> writes:
> ProPAAS DBA <dba@propaas.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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-12-13 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13 23:24 how to find a pg_toast table's primary table ProPAAS DBA <dba@propaas.com>
2016-12-13 23:33 ` Joshua D. Drake <jd@commandprompt.com>
2016-12-13 23:39 ` Jerry Sievers <gsievers19@comcast.net>
2016-12-13 23:46   ` Tom Lane <tgl@sss.pgh.pa.us>
2016-12-13 23:40 ` Jorge Torralba <jorge.torralba@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox