Re: DB size

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, luis(dot)roberto(at)siscobra(dot)com(dot)br, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: DB size
Date: 2021-04-27 07:05:42
Message-ID: CABUevExvFtS5G3ehReoKqAs_xq5ehp_o0GC2rQrqYyq-p4vN-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 27, 2021 at 8:59 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>
> On Mon, 2021-04-26 at 16:45 -0400, Alvaro Herrera wrote:
> > I would guess that there are leftover files because of those crashes you
> > mentioned. You can probably look for files in the database subdir in
> > the data directory that do not appear in the pg_class.relfilenode
> > listing for the database.
>
> Not all tables have their "relfilenode" set:
>
> SELECT relfilenode FROM pg_class WHERE relname = 'pg_class';
> relfilenode
> ═════════════
> 0
> (1 row)

Yeah, you want to use pg_relation_filenode(oid) rather than looking
directly at relfilenode.

When compared to the filesystem, it's probably even easier to use
pg_relation_filepath(oid).

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Durgamahesh Manne 2021-04-27 07:15:30 About to know the info of foreign table reference used in any of call ,views,functions
Previous Message Laurenz Albe 2021-04-27 06:58:46 Re: DB size