聚合函数并发计算
最近更新时间: 2025-02-18 16:02:00
- 单核计算。
postgres=#\timing
Timing ison.
postgres=#set max_parallel_workers_per_gather to 0;
SET
Time:0.633 ms
postgres=#select count(1) from t_count;
count
----------
20000000
(1 row)
Time:3777.518 ms (00:03.778)
- 二核并行。
postgres=#set max_parallel_workers_per_gather to 2;
SET
Time:0.478 ms
postgres=#select count(1) from t_count;
count
----------
20000000
(1 row)
Time:2166.481 ms (00:02.166)
- 四核并行。
postgres=#set max_parallel_workers_per_gather to 4;
SET
Time:0.315 ms
postgres=#select count(1) from t_count;
count
----------
20000000
(1 row)
Time:1162.433 ms (00:01.162)
postgres=#