From: Justin Pryzby <pryzby@telsasoft.com>
To: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: make \d pg_toast.foo show its indices ; and, \d toast show its main table
Date: Mon, 6 May 2019 11:22:51 -0500
Message-ID: <20190506162251.GN3925@telsasoft.com> (raw)
In-Reply-To: <CA+FpmFffNcyO8CcG7O7P72K4-PuzataxT=hfWbaV=SrosMK=Cg@mail.gmail.com>
References: <20190422154902.GH14223@telsasoft.com>
<CA+FpmFfihB-okuPa0sxyhALpXcxMuHJYDS95sqvra6+D5Zkk6g@mail.gmail.com>
<20190503142721.GC3925@telsasoft.com>
<CA+FpmFffNcyO8CcG7O7P72K4-PuzataxT=hfWbaV=SrosMK=Cg@mail.gmail.com>
On Mon, May 06, 2019 at 09:13:52AM +0200, Rafia Sabih wrote:
> On Fri, 3 May 2019 at 16:27, Justin Pryzby <pryzby@telsasoft.com> wrote:
> >
> > On Fri, May 03, 2019 at 02:55:47PM +0200, Rafia Sabih wrote:
> > > On Mon, 22 Apr 2019 at 17:49, Justin Pryzby <pryzby@telsasoft.com> wrote:
> > > >
> > > > It's deliberate that \dt doesn't show toast tables.
> > > > \d shows them, but doesn't show their indices.
> > > >
> > > > It seems to me that their indices should be shown, without having to think and
> > > > know to query pg_index.
> > > >
> > > > postgres=# \d pg_toast.pg_toast_2600
> > > > TOAST table "pg_toast.pg_toast_2600"
> > > > Column | Type
> > > > ------------+---------
> > > > chunk_id | oid
> > > > chunk_seq | integer
> > > > chunk_data | bytea
> > > > Indexes:
> > > > "pg_toast_2600_index" PRIMARY KEY, btree (chunk_id, chunk_seq)
> > >
> > > +1.
> >
> > Thanks - what about also showing the associated non-toast table ?
> >
> IMHO, what makes more sense is to show the name of associated toast
> table in the \dt+ of the normal table.
Perhaps ... but TOAST is an implementation detail, and I think it should rarely
be important to know the toast table for a given table.
I think it's more useful to go the other way (at least), to answer questions
when pg_toast.* table shows up in a query like these:
- SELECT relpages, relname FROM pg_class ORDER BY 1 DESC;
- SELECT COUNT(1), relname FROM pg_class c JOIN pg_buffercache b ON b.relfilenode=c.oid GROUP BY 2 ORDER BY 1 DESC LIMIT 9;
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, rafia.pghackers@gmail.com
Subject: Re: make \d pg_toast.foo show its indices ; and, \d toast show its main table
In-Reply-To: <20190506162251.GN3925@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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