How to get partition info for a partition table?

Started by Yuxia Qiuover 7 years ago2 messagesgeneral
Jump to latest
#1Yuxia Qiu
yuxiaqiu1@gmail.com

HI Dear PostgreSQL,

I am pretty new for this DB.
I have created two partition tables as bellow:
*CREATE TABLE* measurement_year_month (
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (EXTRACT(YEAR FROM logdate), EXTRACT(MONTH FROM
logdate));

*create table* partitionTest(
firstname varchar[20],
lastName varchar[20],
id int
)
partition by range (id, firstname);

*My question is:* how do I retrieve the information like bellow?
*Table name* *Partition type * * Partition
information*
measurement_year_month Range (EXTRACT(YEAR FROM
logdate), EXTRACT(MONTH FROM logdate)
partitionTest Range (id,
firstname)

Thanks in advance.

Regards,
Yuxia

#2legrand legrand
legrand_legrand@hotmail.com
In reply to: Yuxia Qiu (#1)
Re: How to get partition info for a partition table?

see
https://www.postgresql.org/docs/9.5/static/app-psql.html
for psql options an commands:

psql -d ... -U ...
\d+ measurement_year_month

...
Partition key: RANGE (date_part('year'::text, logdate),
date_part('month'::text, logdate))
Number of partitions: 0

if you want to know how postgresql is retrieving those informations
try -E option for ECHO_HIDDEN

psql -d ... -U ... -E
\d+ measurement_year_month

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html