Hi, On 2019/04/08 12:59, Pavel Stehule wrote: > ne 7. 4. 2019 v 21:13 odesÃlatel Alvaro Herrera <alvhe...@2ndquadrant.com> > napsal: >> Added to the docs, and pushed. >> > > Thank you very much
Thank you Alvaro for pushing this to completion. Also, thank you Justin and Pavel for reviewing it till the last minute. Looks pretty good in my testing so far. >> I couldn't resist tweaking the ORDER BY clause, too. I think listing >> all tables first, followed by all indexes, and sorting by parent in each >> category, is much easier to read. (Maybe this can use additional >> tweaking, but it's a minor thing anyway -- for example putting together >> all indexes that correspond to some particular table?) >> >> I noticed that \d never seems to use pg_total_relation_size, so toast >> size is never shown. I did likewise here too and used pg_table_size >> everywhere. I'm not 100% sure this is the most convenient thing. Maybe >> we need yet another column, and/or yet another flag ...? >> > > I prefer some flag - both raw size and total size has sense, but another > column will be less readable I noticed that the size shown in the output of both \dP+ and \dPt+ does include toast relation sizes of (leaf) partitions, because pg_table_size(), which is used by all the queries that listPartitionedTables sends to the server, does: /* * heap size, including FSM and VM */ for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) size += calculate_relation_size(&(rel->rd_node), rel->rd_backend, forkNum); /* * Size of toast relation */ if (OidIsValid(rel->rd_rel->reltoastrelid)) size += calculate_toast_table_size(rel->rd_rel->reltoastrelid); >> Also, I think the new \dP should gain a new flag (maybe "l") to make it >> list leaf tables/indexes too with their local sizes, and remove those >> from the standard \d listing. > > +1 +1 to the idea. Perhaps we'd need to post this in a separate thread to highlight what may be a substantive change to \d's output? Thanks, Amit