1.并行备份恢复
从9.3版本开始支持并行备份。
$ pg_dump --help |grep "\--jobs"
-j, --jobs=NUM use this many parallel jobs to dump
$ pg_restore --help |grep "\--jobs"
-j, --jobs=NUM use this many parallel jobs to restore
并行备份恢复需要配合-Fd格式来使用
2.并行vacuum
从9.5版本开始支持并行清理database。
$ vacuumdb --help |grep "\--jobs"
-j, --jobs=NUM use this many concurrent connections to vacuum
3.并行query、seqscan、nestloop join、aggregate
从9.6版本开始支持并行query、seqscan、nestloop join、aggregate,并行查询开启后,解析器会生成一份Gather…Partial风格的执行计划,Partial部分的计划并行执行。
postgres=# set force_parallel_mode=on;
SET
postgres=# explain (costs off,timing off,analyze on) select count(*) from test;
QUERY PLAN
--------------------------------------------------------------------------
Finalize Aggregate (actual rows=1 loops=1)
-> Gather (actual rows=3 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Partial Aggregate (actual rows=1 loops=3)
-> Parallel Seq Scan on test (actual rows=110187 loops=3)
Planning Time: 0.046 ms
Execution Time: 74.961 ms
(8 rows)
4.并行merge joins
从10版本开始支持。
5.并行bitmap heap scans
从10版本开始支持。
6.并行B-tree index scans
从10版本开始支持。
7.并行创建B-tree索引
从11版本开始支持并行创建B-tree索引。
postgres=# set max_parallel_maintenance_workers =4;
SET
create index concurrently(不堵塞DML)
8.并行hash joins
从11版本开始支持。
postgres=# set enable_parallel_hash = on;
SET
9.SQL命令支持并行重建索引
从12版本开始支持。
reindex concurrently(不堵塞DML)
12版本vacuum也新增了index_cleanup控制索引与表分开回收,也可以在表上进行设置。
10.SQL命令vacuum支持并行
从13版本开始支持,当单个table有多个索引时, 可以并行vacuum索引。
postgres=# vacuum (freeze,verbose,parallel 2);
11.vacuumdb命令调用vacuum时支持并行
从13版本开始支持。
$ vacuumdb --help |grep "\--parallel"
-P, --parallel=PARALLEL_DEGREE use this many background workers for vacuum, if available
12.reindexdb支持并行
从13版本开始支持
$ reindexdb --help |grep "\--jobs"
-j, --jobs=NUM use this many concurrent connections to reindex
最后修改时间:2020-12-24 09:01:27
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。