Postgresql 中文操作指南
Chapter 15. Parallel Query
Table of Contents
PostgreSQL 可以设计出可以利用多个 CPU 以便更快地回答查询的查询计划。此功能称为并行查询。许多查询无法从并行查询中受益,这可能是因为当前实现的限制,或者因为不存在比串行查询计划更快的查询计划。但是,对于可以受益的查询,并行查询通常会大大提高速度。使用并行查询时,许多查询可以运行得快两倍以上,而某些查询可以运行得快四倍甚至更多。典型情况下,查询的数据量很大,但只向用户返回少量行的数据将受益最大。本章解释了并行查询的工作原理的一些详细信息,以及在哪些情况下可以使用它,以便希望使用它的用户可以了解期望的结果。
PostgreSQL can devise query plans that can leverage multiple CPUs in order to answer queries faster. This feature is known as parallel query. Many queries cannot benefit from parallel query, either due to limitations of the current implementation or because there is no imaginable query plan that is any faster than the serial query plan. However, for queries that can benefit, the speedup from parallel query is often very significant. Many queries can run more than twice as fast when using parallel query, and some queries can run four times faster or even more. Queries that touch a large amount of data but return only a few rows to the user will typically benefit most. This chapter explains some details of how parallel query works and in which situations it can be used so that users who wish to make use of it can understand what to expect.