{"Entry":{"collection":"guc","key":"trace_sort","name":"trace_sort","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Developer Options","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"8.0","status":"added","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"17","status":"changed","to":"18"}],"content_hash":"2b71e33281f8d889c0d5062f45a9f5bb6f8adcb8d54e513248dfebe35b9a243e","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"editorial":{"advice":{"olap":"Long analytical runs can amplify trace_sort's debug overhead and artifacts. Prefer standard EXPLAIN and statistics first, and isolate any developer experiment from normal users.","oltp":"Do not tune production OLTP with trace_sort. Enable it only for a bounded reproduction with an owner, log/disk budget, rollback condition, and evidence-capture plan; restore the default immediately afterward.","small":"Keep trace_sort at its upstream default. A small host has less spare CPU, disk, connection, and log capacity for developer instrumentation."},"mechanism":["trace_sort emits internal resource-use messages for sort operations, including memory, run generation, merge passes, and timing details useful to PostgreSQL developers.","It is diagnostic logging, not the same as EXPLAIN's Sort Method output or log_temp_files. Enabling it can produce many messages on sort-heavy workloads.","The switch does not alter work_mem, the sorting algorithm, or spill thresholds. It should be scoped to a reproduction and paired with log-level settings that actually capture the output. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Leaving trace_sort enabled after the bounded diagnostic or recovery task.","Running the experiment on the only copy of production data.","Underestimating log, core-file, temporary-file, WAL, CPU, or connection-slot amplification.","Treating a server that merely starts or completes a query as proof that data and behavior are correct."],"references":[{"title":"PostgreSQL 19 Beta 4: trace_sort","url":"https://www.postgresql.org/docs/19/runtime-config-developer.html#GUC-TRACE-SORT"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["work_mem","log_temp_files","enable_sort","temp_file_limit","log_min_messages"],"summary":"trace_sort — Emit information about resource usage in sorting. Observed in PG9.0–19 Beta 4; its last measured boot default is off in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.1","group":"Developer Options","group_slug":"developer","imported_at":"2026-09-27T17:57:32.195462+08:00","intro_commit":{},"key":"trace_sort","last_version":"20","max_val":"","min_val":"","name":"trace_sort","position":423,"present_in":["8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"If on, emit information about resource usage during sort operations.","short_desc_zh":"","source_rev":"english-manuals:4780b180c053b7eb34653d42fa55ad8aa93d81b7c5d468703c00e44c60735bf3","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"trace_sort","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"trace_sort","SourceRevision":"english-manuals:4780b180c053b7eb34653d42fa55ad8aa93d81b7c5d468703c00e44c60735bf3","Facts":{"boot_val":"off","category":"Developer Options","context":"user","description":"If on, emit information about resource usage during sort operations.","doc":{"anchor":"GUC-TRACE-SORT","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"trace_sort","short_desc":"Emit information about resource usage in sorting.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACE-SORT","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"trace_sort","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"trace_sort","Summary":"","BodyHTML":"\u003cp\u003e如果开启，输出排序操作中的资源使用信息。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"94ba613358216bbeb0a6e30639f1d965b8d25a8fa7ceec3f99d3d3e6f64b3601","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e如果开启，输出排序操作中的资源使用信息。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
