On 2018/06/20 16:50, Pavel Stehule wrote: > 2018-06-20 9:44 GMT+02:00 Amit Langote <langote_amit...@lab.ntt.co.jp>: >> Do you mean \dt continues to show size 0 for partitioned tables, but with >> the new option (\dtP+) shows the actual size by aggregating across >> partitions? +1 to such a feature, but we need to agree on an acceptable >> implementation for that. How does the aggregation happen: >> > > yes - my proposal is no change for \dt for now. I think so we will have to > change it, when partitioning will be more common and number of partitions > will be high. But it is not today. > > \dtP shows only partitions tables (like \dtS shows only system tables), > with "+" shows sum of all related partitions.
Ah, okay. That makes sense. >> 1. In a new dedicated function in the backend (parallel to pg_table_size)? >> >> or >> >> 2. psql issues a separate query to compute the total size of a partition >> tree >> > > In this moment we can simply do sum on client side, so it is related to @2. I see, okay. >> For option 2, I had posted a patch that simplifies writing such a query >> and posted that here: >> >> https://www.postgresql.org/message-id/7a9c5328-5328-52a3- >> 2a3d-bf1434b4dd1d%40lab.ntt.co.jp >> >> With that patch, the query to get the total size of a partition tree >> becomes as simple as: >> >> select sum(pg_table_size(p)) as size >> from pg_get_inheritance_tables('partitioned_table_name') p >> > > good to know it. Thank you. Do you think so your patch should be included > to this feature or will be processed independently? It seems that it would be useful on its own, as people may want to do various things once we provide them pg_get_inheritance_table. Thanks, Amit