Re: pg_(total_)relation_size and partitioned tables

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: pg_(total_)relation_size and partitioned tables
Дата
Msg-id CAKJS1f86CjuW7-6QaXKPZLtcVCMo=ocprNdSk+dcvbpPyXMxtQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_(total_)relation_size and partitioned tables  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: pg_(total_)relation_size and partitioned tables  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On 29 December 2017 at 08:03, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> Here is another idea.  If we had a function
>
> pg_partition_root(regclass) returns regclass
>
> (returning itself for non-partitioned relations), then users can easily
> construct queries to get the results they want in different shapes, e.g.,
>
> select pg_partition_root(c.oid), c.relname, pg_table_size(c.oid)
>   from pg_class c
>   order by 1
>
> select pg_partition_root(c.oid), sum(pg_table_size(c.oid))
>   from pg_class c
>   group by 1

That seems much nicer. I assume "root" would mean the top level
partitioned table. If so, would we also want
pg_partition_parent(regclass)? Or maybe something to control the
number of "levels-up" the function would run for. If we had that then
maybe -1 could mean "go until you find a table with no parent".

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: [HACKERS] replace GrantObjectType with ObjectType
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Proposal: Local indexes for partitioned table