{"Entry":{"collection":"guc","key":"enable_incremental_sort","name":"enable_incremental_sort","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Method Configuration","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"12","status":"added","to":"13"}],"content_hash":"e22a02939cc9b05c7d9e4c964b573a9c3bda7409a9ceeb53c0cc6c1b49cac39d","context":"","default_changed_in":[],"default_history":[{"from":"13","to":"19","value":"on"}],"editorial":{"advice":{"olap":"Benchmark representative analytical plans with and without enable_incremental_sort. Judge planning time, memory, spill, and execution time together; a win for one report is not evidence for a global setting.","oltp":"Keep the upstream default for routine OLTP. Use a transaction- or session-local change to diagnose whether choosing incremental sort, which sorts within groups that are already ordered by a prefix of the required keys explains a regression, then repair statistics, indexes, estimates, or query shape instead of leaving a cluster-wide method ban.","small":"Do not use enable_incremental_sort as a permanent hint on a small host. Resource pressure may change the best method, so verify with EXPLAIN (ANALYZE, BUFFERS) and keep the change scoped to the affected workload if it is still needed."},"mechanism":["enable_incremental_sort controls whether the planner may choose incremental sort, which sorts within groups that are already ordered by a prefix of the required keys.","It is consulted while a plan is built. A session-level change is useful for comparing EXPLAIN alternatives, but an already cached plan is not retroactively rewritten; invalidation or replanning is required to observe a different choice.","The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Treating enable_incremental_sort as a query hint even though it affects every plan built in its scope.","Testing an already cached prepared plan and concluding that the setting has no effect.","Masking stale statistics or cardinality errors by disabling a plan method globally.","The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself."],"references":[{"title":"PostgreSQL 19 Beta 4: enable_incremental_sort","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-ENABLE-INCREMENTAL-SORT"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["enable_sort","enable_gathermerge","work_mem","enable_presorted_aggregate"],"summary":"enable_incremental_sort — Enables the planner's use of incremental sort steps. Observed in PG13–19 Beta 4; its last measured boot default is on in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"13","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:31.194138+08:00","intro_commit":{"authored_at":"2020-07-05T11:41:52+02:00","discussion":["https://www.postgresql.org/message-id/flat/df652910-e985-9547-152c-9d4357dc3979%402ndquadrant.com"],"hash":"94e454cddfbae5e32ae7bb70fedd24f243cd486a","subject":"Rename enable_incrementalsort for clarity","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=94e454cddfbae5e32ae7bb70fedd24f243cd486a"},"key":"enable_incremental_sort","last_version":"20","max_val":"","min_val":"","name":"enable_incremental_sort","position":121,"present_in":["13","14","15","16","17","18","19","20"],"short_desc":"Enables or disables the query planner's use of incremental sort steps.","short_desc_zh":"","source_rev":"english-manuals:ce50fac95d22b4443c9b372805261c7d41dcec23fdf580b93f70f7f603400b32","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"enable_incremental_sort","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"enable_incremental_sort","SourceRevision":"english-manuals:ce50fac95d22b4443c9b372805261c7d41dcec23fdf580b93f70f7f603400b32","Facts":{"boot_val":"on","category":"Query Tuning / Planner Method Configuration","context":"user","description":"Enables or disables the query planner's use of incremental sort steps. The default is on.","doc":{"anchor":"GUC-ENABLE-INCREMENTAL-SORT","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"enable_incremental_sort","short_desc":"Enables the planner's use of incremental sort steps.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-ENABLE-INCREMENTAL-SORT","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"enable_incremental_sort","SourceDatabase":"center","Version":"18","Locale":"en","Title":"enable_incremental_sort","Summary":"Enables or disables the query planner's use of incremental sort steps. The default is on.","BodyHTML":"\u003cp\u003eEnables or disables the query planner\u0026#39;s use of incremental sort steps. The default is on.\u003c/p\u003e","SourceRevision":"english-manuals:ce50fac95d22b4443c9b372805261c7d41dcec23fdf580b93f70f7f603400b32","ContentHash":"0372129abe4ae5ce2480a2df1cfb307ec43afc226ba99441e667c00264acb21f","Payload":{"description":"Enables or disables the query planner's use of incremental sort steps. The default is on."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
