We’re lucky to have two great Open Source databases, MySQL and Postgresql.
One of the killer features in both MySQL and Postgresql is table partitions – for example, most Silicon Valley adtech companies are powered by MySQL partitions.
They let enterprises, and growing startups, easily manage large volumes of data.
- drop millions of rows without purge thread or VACUUM workload, esp. useful for time-series (logging) and retention compliance requirements
- save storage space by implying the key in the table name
- allow transportable tablespaces for archiving and repair or storage management
- allow smaller table scans and index lookups by isolating the row range
- potentially allow “parallel query execution” (I believe Oracle has a patent on this, but eventually patents expire.)
- potentially allow parallel writes across partitions. I believe this already works in recent versions of MySQL/InnoDB and since Postgresql 8.0.
- syntax restrictions on secondary keys, triggers, etc. so read the manual first
- pgloader does not support CREATE PARTITION as of Jan. 27, 2018. (The author is looking for sponsorship however.)
Simpler syntax for Postgresql 10, known as declarative partitioning, has been announced that is similar to MySQL’s syntax.
Here’s a chart comparing partitions across database products:
|Feature||MySQL 5.0+||Postgresql 8.0+||Postgresql 10.0||Postgresql 11.0|
|Table Partition Syntax||5.7||9.6||10||TBD|
The MySQL bug database lists many serious partition bugs in 5.0 and 5.1, so it’s important to use the latest version possible. MySQL also supports merge tables for MyISAM tables.
Chapter 15 of “PostgreSQL 9 High Performance Book Review” covers Postgresql 9 partitions.
PostgreSQL Partition Manager Extension (pg_partman), Blog, github
Yahoo MySQL Partition Manager, Blog
PostgreSQL 10: Partitions of… partitions! HN Discussion
wiki.postgresql.org: Table partitioning
Creating partitions automatically in PostgreSQL
rhaas.blogspot.com: Plans for Partitioning in v11
reddit: What are some bad things about PostgreSQL?
PostgreSQL 10 – table partitioning – how to check partitions and manipulate with them