Re: ToDo: show size of partitioned table - Mailing list pgsql-hackers
From | Pavel Stehule |
---|---|
Subject | Re: ToDo: show size of partitioned table |
Date | |
Msg-id | CAFj8pRDE73OJZjxNv9Wf5iQRxDKQ5Ph9B2pGV+=PVAm65EgEXA@mail.gmail.com Whole thread Raw |
In response to | Re: ToDo: show size of partitioned table (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>) |
Responses |
Re: ToDo: show size of partitioned table
|
List | pgsql-hackers |
pá 2. 11. 2018 v 6:17 odesílatel Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> napsal:
Hi,
On 2018/11/01 2:19, Pavel Stehule wrote:
> st 31. 10. 2018 v 7:34 odesílatel Amit Langote <
> Langote_Amit_f8@lab.ntt.co.jp> napsal:
>> On 2018/10/31 15:30, Pavel Stehule wrote:
>>> st 31. 10. 2018 v 3:27 odesílatel Amit Langote <
>>> Langote_Amit_f8@lab.ntt.co.jp> napsal:
>>>> + appendPQExpBufferStr(&buf, "\nWHERE c.relkind IN ('p')\n");
>>>>
>>>> I wonder if we should list partitioned indexes ('I') as well, because
>>>> their size information is not available with \di+. But maybe, they
>> should
>>>> have a separate command.
>>>>
>>>
>>> I though about it too and I prefer separate command. Similar to \di+
>>
>> Okay, maybe \dI+.
>>
>>
> what about combination
>
> \dPt+ for partitined tables and size
> \dPi+ for indexes on partitioned tables and size
> \dP+ for total partition size (tables + indexes)
+1
here is a patch
postgres=# \dt+
List of relations
┌────────┬───────────┬───────┬───────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Size │ Description │
╞════════╪═══════════╪═══════╪═══════╪═════════╪═════════════╡
│ public │ data │ table │ pavel │ 0 bytes │ │
│ public │ data_2016 │ table │ pavel │ 18 MB │ │
│ public │ data_2017 │ table │ pavel │ 17 MB │ │
└────────┴───────────┴───────┴───────┴─────────┴─────────────┘
(3 rows)
postgres=# \di+
List of relations
┌────────┬────────────────────────┬───────┬───────┬───────────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Table │ Size │ Description │
╞════════╪════════════════════════╪═══════╪═══════╪═══════════╪═════════╪═════════════╡
│ public │ data_2016_inserted_idx │ index │ pavel │ data_2016 │ 11 MB │ │
│ public │ data_2016_value_idx │ index │ pavel │ data_2016 │ 15 MB │ │
│ public │ data_2017_inserted_idx │ index │ pavel │ data_2017 │ 10 MB │ │
│ public │ data_2017_value_idx │ index │ pavel │ data_2017 │ 14 MB │ │
│ public │ data_inserted_idx │ index │ pavel │ data │ 0 bytes │ │
│ public │ data_value_idx │ index │ pavel │ data │ 0 bytes │ │
└────────┴────────────────────────┴───────┴───────┴───────────┴─────────┴─────────────┘
(6 rows)
List of relations
┌────────┬───────────┬───────┬───────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Size │ Description │
╞════════╪═══════════╪═══════╪═══════╪═════════╪═════════════╡
│ public │ data │ table │ pavel │ 0 bytes │ │
│ public │ data_2016 │ table │ pavel │ 18 MB │ │
│ public │ data_2017 │ table │ pavel │ 17 MB │ │
└────────┴───────────┴───────┴───────┴─────────┴─────────────┘
(3 rows)
postgres=# \di+
List of relations
┌────────┬────────────────────────┬───────┬───────┬───────────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Table │ Size │ Description │
╞════════╪════════════════════════╪═══════╪═══════╪═══════════╪═════════╪═════════════╡
│ public │ data_2016_inserted_idx │ index │ pavel │ data_2016 │ 11 MB │ │
│ public │ data_2016_value_idx │ index │ pavel │ data_2016 │ 15 MB │ │
│ public │ data_2017_inserted_idx │ index │ pavel │ data_2017 │ 10 MB │ │
│ public │ data_2017_value_idx │ index │ pavel │ data_2017 │ 14 MB │ │
│ public │ data_inserted_idx │ index │ pavel │ data │ 0 bytes │ │
│ public │ data_value_idx │ index │ pavel │ data │ 0 bytes │ │
└────────┴────────────────────────┴───────┴───────┴───────────┴─────────┴─────────────┘
(6 rows)
postgres=# \dP+
List of partitioned relations
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 84 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)
postgres=# \dPt+
List of partitioned tables
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 35 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)
postgres=# \dPi+
List of partitioned indexes
┌────────┬───────────────────┬───────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Table │ Size │ Description │
╞════════╪═══════════════════╪═══════╪═══════╪═══════╪═════════════╡
│ public │ data_inserted_idx │ pavel │ data │ 21 MB │ │
│ public │ data_value_idx │ pavel │ data │ 28 MB │ │
└────────┴───────────────────┴───────┴───────┴───────┴─────────────┘
(2 rows)
List of partitioned relations
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 84 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)
postgres=# \dPt+
List of partitioned tables
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 35 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)
postgres=# \dPi+
List of partitioned indexes
┌────────┬───────────────────┬───────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Table │ Size │ Description │
╞════════╪═══════════════════╪═══════╪═══════╪═══════╪═════════════╡
│ public │ data_inserted_idx │ pavel │ data │ 21 MB │ │
│ public │ data_value_idx │ pavel │ data │ 28 MB │ │
└────────┴───────────────────┴───────┴───────┴───────┴─────────────┘
(2 rows)
Thanks,
Amit
Attachment
pgsql-hackers by date: