14
2-2.pg_bench でパーティション
● 結果を見てみると
=#d+ pgbench_accounts
Partitioned table "public.pgbench_accounts"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------+---------------+-----------+----------+---------+----------+--------------+-------------
aid | integer | | not null | | plain | |
bid | integer | | | | plain | |
abalance | integer | | | | plain | |
filler | character(84) | | | | extended | |
Partition key: RANGE (aid)
Indexes:
"pgbench_accounts_pkey" PRIMARY KEY, btree (aid)
Partitions: pgbench_accounts_1 FOR VALUES FROM (MINVALUE) TO (100001),
pgbench_accounts_10 FOR VALUES FROM (900001) TO (MAXVALUE),
pgbench_accounts_2 FOR VALUES FROM (100001) TO (200001),
pgbench_accounts_3 FOR VALUES FROM (200001) TO (300001),
pgbench_accounts_4 FOR VALUES FROM (300001) TO (400001),
pgbench_accounts_5 FOR VALUES FROM (400001) TO (500001),
pgbench_accounts_6 FOR VALUES FROM (500001) TO (600001),
pgbench_accounts_7 FOR VALUES FROM (600001) TO (700001),
pgbench_accounts_8 FOR VALUES FROM (700001) TO (800001),
pgbench_accounts_9 FOR VALUES FROM (800001) TO (900001)
レンジパーティションとして 10 個に分割されている。
16
2-3.SQL をコピペしやすくなった
● 13の新機能「 SET PROMPT2 」を使うと
postgres=# set PROMPT2 ''
postgres=# SELECT
'2019-12-01'::date + g
FROM
generate_series(0, 3) AS g;
2 行目以降を空白など好きな文字列にできる。
※ コピペしやすくなった
空白以外も指定可能
postgres=# set PROMPT2 '> '
postgres=# SELECT
> '2019-12-01'::date + g
> FROM
> generate_series(0, 3) AS g;