↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 配置参数

debug_parallel_query

允许出于测试目的使用并行查询,即使预计不会带来性能收益也是如此。debug_parallel_query 的允许值为 off(仅在预期会提高性能时使用并行模式),on(对所有被认为安全的查询强制使用并行查询),以及 regress(类似于 on,但有下文所述的额外行为变化)。 更具体地说,将该值设置为 on 会在任何看起来安全的查询计划顶部添加一个 Gather 节点,以便查询在并行工作进程中运行。即使并行工作进程不可用或无法使用,启动子事务等在并行查询上下文中被禁止的操作也将被禁止,除非规划器认为这样会导致查询失败。如果设置此选项时出现故障或意外结果,则可能需要将查询使用的一些函数标记为 PARALLEL UNSAFE(或可能是 PARALLEL RESTRICTED)。 将该值设置为 regress 会产生与设置为 on 相同的所有效果,并额外启用一些行为,以便进行自动回归测试。通常,来自并行工作进程的消息会包含一行上下文说明,但 regress 会抑制这一行,因此输出与非并行执行时相同。此外,由该设置添加到计划中的 Gather 节点会在 EXPLAIN 输出中被隐藏,以便输出与此设置为 off 时得到的结果一致。

英文手册覆盖始于 PostgreSQL 7.4. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 19·选择有来源记录的版本

boot val
off
category
Developer Options
context
user
doc same as
未知
documented
true
enumvals
off, on, regress
extra desc
This can be useful for testing the parallel query infrastructure by forcing the planner to generate plans that contain nodes that perform tuple communication between workers and the main process.
lang
en
max val
未知
metadata version
19beta4
min val
未知
name
debug_parallel_query
short desc
Forces the planner's use parallel query nodes.
source
pg-settings-source-snapshot
unit
未知
vartype
enum

版本定义 PG 19

允许出于测试目的使用并行查询,即使预计不会带来性能收益也是如此。debug_parallel_query 的允许值为 off(仅在预期会提高性能时使用并行模式),on(对所有被认为安全的查询强制使用并行查询),以及 regress(类似于 on,但有下文所述的额外行为变化)。

更具体地说,将该值设置为 on 会在任何看起来安全的查询计划顶部添加一个 Gather 节点,以便查询在并行工作进程中运行。即使并行工作进程不可用或无法使用,启动子事务等在并行查询上下文中被禁止的操作也将被禁止,除非规划器认为这样会导致查询失败。如果设置此选项时出现故障或意外结果,则可能需要将查询使用的一些函数标记为 PARALLEL UNSAFE(或可能是 PARALLEL RESTRICTED)。

将该值设置为 regress 会产生与设置为 on 相同的所有效果,并额外启用一些行为,以便进行自动回归测试。通常,来自并行工作进程的消息会包含一行上下文说明,但 regress 会抑制这一行,因此输出与非并行执行时相同。此外,由该设置添加到计划中的 Gather 节点会在 EXPLAIN 输出中被隐藏,以便输出与此设置为 off 时得到的结果一致。

比较版本

完整来源事实

doc html

<p>
        Allows the use of parallel queries for testing purposes even in cases
        where no performance benefit is expected.
        The allowed values of <code class="varname">debug_parallel_query</code> are
        <code class="literal">off</code> (use parallel mode only when it is expected to improve
        performance), <code class="literal">on</code> (force parallel query for all queries
        for which it is thought to be safe), and <code class="literal">regress</code> (like
        <code class="literal">on</code>, but with additional behavior changes as explained
        below).
       </p><p>
        More specifically, setting this value to <code class="literal">on</code> will add
        a <code class="literal">Gather</code> node to the top of any query plan for which this
        appears to be safe, so that the query runs inside of a parallel worker.
        Even when a parallel worker is not available or cannot be used,
        operations such as starting a subtransaction that would be prohibited
        in a parallel query context will be prohibited unless the planner
        believes that this will cause the query to fail.  If failures or
        unexpected results occur when this option is set, some functions used
        by the query may need to be marked <code class="literal">PARALLEL UNSAFE</code>
        (or, possibly, <code class="literal">PARALLEL RESTRICTED</code>).
       </p><p>
        Setting this value to <code class="literal">regress</code> has all of the same effects
        as setting it to <code class="literal">on</code> plus some additional effects that are
        intended to facilitate automated regression testing.  Normally,
        messages from a parallel worker include a context line indicating that,
        but a setting of <code class="literal">regress</code> suppresses this line so that the
        output is the same as in non-parallel execution.  Also,
        the <code class="literal">Gather</code> nodes added to plans by this setting are hidden
        in <code class="literal">EXPLAIN</code> output so that the output matches what
        would be obtained if this setting were turned <code class="literal">off</code>.
       </p>

documentation revision

{"inputs":[{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"44a1ecd5d3b37a3cbfe9e38d974931b46567a167311e11baaea0c5816b033e8b","version":"19rc2"},{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"537fd5a2901e554c1bd89332a049781a3456a721270c9278b44c749b341ffabf","version":"19rc2"}],"release":"19rc2","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 19 · wiki-repair-20261023:b6c5a3975c8e17dc40f13ffe34de7dd417cf00d9193ec3cbf375ee3607b3f44d

正文语言: zh-Hans · wiki-repair-20261023:b6c5a3975c8e17dc40f13ffe34de7dd417cf00d9193ec3cbf375ee3607b3f44d