官术网_书友最值得收藏!

  • Mastering PostgreSQL 9.6
  • Hans Jurgen Schonig
  • 221字
  • 2021-07-09 19:57:11

Introducing parallel queries

Traditionally, a query had to run on a single CPU. While this was just fine in the OLTP world, it started to be a problem for analytical applications, which were bound to the speed provided by a single core. With PostgreSQL 9.6, parallel queries were introduced. Of course, implementing parallel queries was hard and so a lot of infrastructure has already been implemented over the years. All this infrastructure is now available to provide the end user with parallel sequential scans. The idea is to make many CPUs work on complicated WHERE conditions during a sequential scan. Version 9.6 also allowed for parallel aggregates and parallel joins. Of course, there is a lot of work left, but we are already looking at a major leap forward.

To control parallelism, there are two essential settings:

test=# SHOW max_worker_processes; 
max_worker_processes
----------------------
8
(1 row)

test=# SHOW max_parallel_workers_per_gather ;
max_parallel_workers_per_gather
---------------------------------
2
(1 row)

The first one limits the overall number of worker processes available. The second one controls the number of workers allowed per gather node.

A gather node is a new thing you will see in an execution plan. It is in charge of unifying results coming from parallel subprocesses.

In addition to those fundamental settings, there are a couple of new optimizer parameters to adjust the cost of parallel queries.

主站蜘蛛池模板: 大悟县| 浦县| 繁峙县| 张北县| 福清市| 大丰市| 高雄市| 玛多县| 靖安县| 汨罗市| 普宁市| 蓬莱市| 开化县| 当涂县| 恭城| 黄平县| 凤冈县| 南丹县| 娱乐| 高清| 太和县| 成都市| 香港 | 汾西县| 安国市| 筠连县| 盖州市| 陇南市| 东至县| 宣城市| 南岸区| 锦屏县| 锡林浩特市| 油尖旺区| 巢湖市| 元朗区| 保靖县| 涿鹿县| 松滋市| 吉安市| 莆田市|