{"Entry":{"collection":"guc","key":"cpu_tuple_cost","name":"cpu_tuple_cost","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Cost Constants","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"}],"content_hash":"be0bb2ffb674b7e085789691c8202fab28c57c7c064aa50d20b7c1a88bf42106","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"0.01"}],"editorial":{"advice":{"olap":"Analytical workloads can justify a different CPU-versus-I/O balance, but change cpu_tuple_cost together with the related cost model and validate the full scan/join/aggregate mix.","oltp":"Calibrate cpu_tuple_cost only from a representative workload, not one plan. First correct stale statistics and compare EXPLAIN (ANALYZE, BUFFERS) estimates with reality; use role or tablespace scope where possible.","small":"Keep the upstream value unless repeated evidence shows a systematic modeling error. On small systems, concurrency and cache residency often matter more than fine-grained changes to cpu_tuple_cost."},"mechanism":["cpu_tuple_cost models the CPU work to process one row. It is one term in estimated path cost and does not allocate resources or change executor behavior directly.","Planner cost units are arbitrary and only their ratios matter. Scaling all cost constants together leaves path ordering unchanged; changing one alters the balance between I/O, row processing, operators, and parallel overhead.","The value is consulted when a plan is built. Statistics, row-count estimates, cache assumptions, tablespace overrides, and enabled plan methods can outweigh a small change in this constant. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Interpreting the value as elapsed time or a hard resource limit.","Tuning it to repair one query and regressing the wider workload.","Changing cost constants before correcting statistics and cardinality estimates.","Forgetting that only relative values influence path choice."],"references":[{"title":"PostgreSQL 19 Beta 4: cpu_tuple_cost","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-CPU-TUPLE-COST"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["cpu_index_tuple_cost","cpu_operator_cost","seq_page_cost","random_page_cost","enable_seqscan"],"summary":"cpu_tuple_cost — Sets the planner's estimate of the cost of processing each tuple (row). Observed in PG9.0–19 Beta 4; its last measured boot default is 0.01 in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"7.4","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:30.994049+08:00","intro_commit":{},"key":"cpu_tuple_cost","last_version":"20","max_val":"","min_val":"","name":"cpu_tuple_cost","position":72,"present_in":["7.4","8.0","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":"Sets the planner's estimate of the cost of processing each row during a query.","short_desc_zh":"","source_rev":"english-manuals:2ff0004bd5ff451bfc74a035d05aad31b816731c34bce793fbfec7212cc372a0","unit":"","vartype":"real"}},"Definition":{"Collection":"guc","Key":"cpu_tuple_cost","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"cpu_tuple_cost","SourceRevision":"english-manuals:2ff0004bd5ff451bfc74a035d05aad31b816731c34bce793fbfec7212cc372a0","Facts":{"boot_val":"0.01","category":"Query Tuning / Planner Cost Constants","context":"user","description":"Sets the planner's estimate of the cost of processing each row during a query. The default is 0.01.","doc":{"anchor":"GUC-CPU-TUPLE-COST","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"1.79769e+308","metadata_version":"18","min_val":"0","name":"cpu_tuple_cost","short_desc":"Sets the planner's estimate of the cost of processing each tuple (row).","source":"pg-settings-source-snapshot","unit":null,"vartype":"real"},"ManualEvidence":{"doc":{"anchor":"GUC-CPU-TUPLE-COST","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"cpu_tuple_cost","SourceDatabase":"center","Version":"18","Locale":"en","Title":"cpu_tuple_cost","Summary":"Sets the planner's estimate of the cost of processing each row during a query. The default is 0.01.","BodyHTML":"\u003cp\u003eSets the planner\u0026#39;s estimate of the cost of processing each row during a query. The default is 0.01.\u003c/p\u003e","SourceRevision":"english-manuals:2ff0004bd5ff451bfc74a035d05aad31b816731c34bce793fbfec7212cc372a0","ContentHash":"a93bf06730cabac482f3ca1df781f8b6f58aa37086a4dd3746a9d637137c8f2a","Payload":{"description":"Sets the planner's estimate of the cost of processing each row during a query. The default is 0.01."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
