Wiki / Configuration Parameters
enable_presorted_aggregate
Controls if the query planner will produce a plan which will provide rows which are presorted in the order required for the query's ORDER BY / DISTINCT aggregate functions. When disabled, the query planner will produce a plan which will always require the executor to perform a sort before performing aggregation of each aggregate function containing an ORDER BY or DISTINCT clause. When enabled, the planner will try to produce a more efficient plan which provides input to the aggregate functions which is presorted in the order they require for aggregation. The default value is on.
English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- boot val
- on
- category
- Query Tuning / Planner Method Configuration
- context
- user
- documented
- true
- enumvals
- Unknown
- extra desc
- Allows the query planner to build plans that provide presorted input for aggregate functions with an ORDER BY / DISTINCT clause. When disabled, implicit sorts are always performed during execution.
- lang
- en
- max val
- Unknown
- metadata version
- 18
- min val
- Unknown
- name
- enable_presorted_aggregate
- short desc
- Enables the planner's ability to produce plans that provide presorted input for ORDER BY / DISTINCT aggregate functions.
- source
- pg-settings-source-snapshot
- unit
- Unknown
- vartype
- bool
Definition PG 18
Controls if the query planner will produce a plan which will provide rows which are presorted in the order required for the query's ORDER BY / DISTINCT aggregate functions. When disabled, the query planner will produce a plan which will always require the executor to perform a sort before performing aggregation of each aggregate function containing an ORDER BY or DISTINCT clause. When enabled, the planner will try to produce a more efficient plan which provides input to the aggregate functions which is presorted in the order they require for aggregation. The default value is on.
Compare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:3eb365c62464b0ef642f1394e8322ce709a4f89d14b65b3b39b47d65c5694ab9
Text language: en · wiki-repair-20261023:3eb365c62464b0ef642f1394e8322ce709a4f89d14b65b3b39b47d65c5694ab9