これは、PostgreSQL Advent Calendar 2017の16日目の記事です。 はじめに 以前の記事で、パーティション数が多いほどプラン生成時間が長くなることを、パーティション数0〜1000で確認しました。今回は、20万パーティションを作成したい気分だったので、パーティションを1000ずつ20万まで作成ながら、各パーティション数でのプラン生成時間を確認します。 パーティションの作成 ネイティブ・パーティショニング機能を使い、以下のようなパーティションを作成します。パーティションにはレコードを格納せず、空のままとします。PostgreSQLのバージョンは10.1(を改造したもの1)です。 -- (親)テーブル CREATE TABLE test (key INT, val TEXT) PARTITION BY LIST (key); -- パーティション CREATE TABL