Slide 34
Slide 34 text
⑤パラレルクエリ
PostgreSQL 12の例(さきほどの非パーティショニングテーブルにて)
34
no_partition_test=# SET max_parallel_workers_per_gather=2;
SET
no_partition_test=# EXPLAIN VERBOSE SELECT log_datetime, COUNT(*) FROM log_record GROUP BY log_datetime;
QUERY PLAN
----------------------------------------------------------------------------------------------------------
Finalize GroupAggregate (cost=13902.96..13921.21 rows=72 width=16)
Output: log_datetime, count(*)
Group Key: log_record.log_datetime
-> Gather Merge (cost=13902.96..13919.77 rows=144 width=16)
Output: log_datetime, (PARTIAL count(*))
Workers Planned: 2
-> Sort (cost=12902.94..12903.12 rows=72 width=16)
Output: log_datetime, (PARTIAL count(*))
Sort Key: log_record.log_datetime
-> Partial HashAggregate (cost=12900.00..12900.72 rows=72 width=16)
Output: log_datetime, PARTIAL count(*)
Group Key: log_record.log_datetime
-> Parallel Seq Scan on public.log_record (cost=0.00..12600.00 rows=60000 width=8)
Output: log_id, log_datetime, log_text
(14 rows)
Time: 0.597 ms
Workerプロセスを2に
(デフォルトで有効)