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

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.

主站蜘蛛池模板: 依兰县| 松江区| 祁连县| 赞皇县| 通江县| 承德县| 绍兴县| 都匀市| 临夏县| 娱乐| 龙游县| 广昌县| 南溪县| 大渡口区| 武宁县| 临汾市| 大姚县| 绥阳县| 乐山市| 高州市| 武乡县| 胶州市| 扎兰屯市| 从江县| 西华县| 都昌县| 鹤庆县| 青岛市| 闵行区| 乐至县| 黑龙江省| 大理市| 乐清市| 桃园县| 正蓝旗| 松溪县| 安宁市| 宣武区| 旺苍县| 石首市| 噶尔县|