In Oracle, MySQL I can select from partition
SELECT ... FROM ... PARTITION (...)
In SQL Server syntax is a bit different involving partitioning function.
is there a way to do it in PostgreSQL?
thank you!
In Oracle, MySQL I can select from partition
SELECT ... FROM ... PARTITION (...)
In SQL Server syntax is a bit different involving partitioning function.
is there a way to do it in PostgreSQL?
thank you!
PostgreSQL provided partitioning through table inheritance.
Partitions are child tables with an unique name like any other table, so you just select from them directly with their names. The only special case is for the parent table: to select data from the parent table ignoring the child tables, an additional keyword ONLY is used as in SELECT * FROM ONLY parent_table.
Example from the manual:
CREATE TABLE measurement_y2006m02 (
CHECK ( logdate >= DATE '2006-02-01' AND logdate < DATE '2006-03-01' )
) INHERITS (measurement);
So select * from measurement_y2006m02 would get data from only this partition.