How to make use of partitioned table for faster query? - Mailing list pgsql-general

From Patrick Dung
Subject How to make use of partitioned table for faster query?
Date
Msg-id 1409373503.85066.YahooMailNeo@web193506.mail.sg3.yahoo.com
Whole thread Raw
Responses Re: How to make use of partitioned table for faster query?  (John R Pierce <pierce@hogranch.com>)
List 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 by date:

Previous
From: Patrick Dung
Date:
Subject: Re: Is there a function to save schema history internally?
Next
From: John R Pierce
Date:
Subject: Re: How to make use of partitioned table for faster query?