pg_(total_)relation_size and partitioned tables

Поиск
Список
Период
Сортировка
От Amit Langote
Тема pg_(total_)relation_size and partitioned tables
Дата
Msg-id 495cec7e-f8d9-7e13-4807-90dbf4eec4ea@lab.ntt.co.jp
обсуждение исходный текст
Ответы Re: pg_(total_)relation_size and partitioned tables
Список pgsql-hackers
Hi.

You may have guessed from $subject that the two don't work together.

create table p (a int) partition by list (a);
create table p1 partition of p for values in (1, 2) partition by list (a);
create table p11 partition of p1 for values in (1);
create table p12 partition of p1 for values in (2);
insert into p select i % 2 + 1 from generate_series(1, 1000) i;

On HEAD:

select pg_relation_size('p');
 pg_relation_size
------------------
                0
(1 row)

select pg_total_relation_size('p');
 pg_total_relation_size
------------------------
                      0
(1 row)

After applying the attached patch:

select pg_relation_size('p');
 pg_relation_size
------------------
            49152
(1 row)

select pg_total_relation_size('p');
 pg_total_relation_size
------------------------
                  98304
(1 row)

The patch basically accumulates and returns the sizes of all leaf
partitions when passed a partitioned table.  Will add it to next CF.

Thanks,
Amit

Вложения

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