How to make use of partitioned table for faster query?

Поиск
Список
Период
Сортировка
От Patrick Dung
Тема How to make use of partitioned table for faster query?
Дата
Msg-id 1409373503.85066.YahooMailNeo@web193506.mail.sg3.yahoo.com
обсуждение исходный текст
Ответы Re: How to make use of partitioned table for faster query?
Список pgsql-general
Hello Postgresql users,

Suppose the table 'attendance' is very large:
id bigint
student_name varchar
late boolean
record_timestamp timestamp

The table is already partitioned by year (attendance_2012p, attendance_2013p, ...).
I would like to count the number of lates by year.

Instead of specifying the partition tables name:
select count(*) from attendance_2012p where student_name="Student A" and late='true';
select count(*) from attendance_2013p where student_name="Student A" and late='true';
select count(*) from attendance_2014p where student_name="Student A" and late='true';
...

Is it possible to query the master table attendance), and the query could make use of the partitioned table for faster query?

Thanks and regards,
Patrick

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

Предыдущее
От: Patrick Dung
Дата:
Сообщение: Re: Is there a function to save schema history internally?
Следующее
От: John R Pierce
Дата:
Сообщение: Re: How to make use of partitioned table for faster query?