Re: pg_(total_)relation_size and partitioned tables

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_(total_)relation_size and partitioned tables
Date: 2017-12-18 07:19:37
Message-ID: CAB7nPqTMJm2_sEhQggUut=X=EmjN4n7-WhTfvMVZyNsf1o5A=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 18, 2017 at 2:17 PM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Do you (and/or others) think that's something that we can wrap inside a
> built-in function(s), that is, one defined in system_views.sql? Or if we
> decide to have new functions, say, pg_get_partitions() and/or
> pg_get_partition_sizes(), we might as well implement them as C functions
> inside dbsize.c. If so, do we have want to have "partition" variants of
> all *_size() functions viz. pg_relation_size(), pg_total_relation_size(),
> pg_indexes_size(), and pg_table_size()?

I can see value in something like Robert is proposing upthread by
having a function one is able to customize to decide what to include
in the calculation. There could be options for at least:
- partitions, or relation cascading.
- index.
- toast tables.
- visibility maps.
- FSM.
The first three ones is what Robert are mentioned, still I would see
the last two ones are interesting things if optional. Or we could have
just a SRF that returns one row per object scanned.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2017-12-18 07:38:56 Re: [HACKERS] replace GrantObjectType with ObjectType
Previous Message Amit Langote 2017-12-18 05:17:36 Re: pg_(total_)relation_size and partitioned tables