labscros.blogg.se

Postgresql partition by
Postgresql partition by











postgresql partition by

Time_of_stop | time without time zone | | | | plain | | Partition of traffic_violations_p_list DEFAULT Īgain, psql will display the partitions nicely:Ĭolumn | Type | Collation | Nullable | Default | Storage | Stats target | Description Partitioned table "affic_violations_p_list"Ĭreate table traffic_violations_p_list_warningĬreate table traffic_violations_p_list_seroĬreate table traffic_violations_p_list_CitationĬreate table traffic_violations_p_list_ESEROĬreate table traffic_violations_p_list_default Psql will show the list partitioning strategy as well: The definition of the table and it’s partitions is pretty much the same as for range partitioning but this time we go for list partitioning: Partitioning by that would result in 4 partitions (plus one default partition for any other potential violation type in the future). Postgres=# select distinct violation_type from mv_traffic_violations The application might want to ask for all traffic violations that match a specific violation type:

postgresql partition by

Time_of_stop | time without time zone | | | Materialized view "public.mv_traffic_violations"Ĭolumn | Type | Collation | Nullable | Default Instead of partitioning by a range (typically based on day, year, month) list partitioning is used to partition on an explicit list with key values that define the partitions.Ĭoming back to the materialized view which holds our initial data set: In this post we look at another partitioning strategy: List partitioning.

Postgresql partition by series#

In the last posts of this series we prepared the data set and had a look at range partitioning.













Postgresql partition by