{"Entry":{"collection":"guc","key":"log_parameter_max_length","name":"log_parameter_max_length","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / What to Log","category_zh":"","changed_in":["15","18"],"changes":[{"documentation_changed":false,"fields":{},"from":"12","status":"added","to":"13"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{"short_desc":{"from":"When logging statements, limit logged parameter values to first N bytes.","to":"Sets the maximum length in bytes of data logged for bind parameter values when logging statements."}},"from":"14","status":"changed","to":"15"},{"documentation_changed":false,"fields":{"extra_desc":{"from":"-1 to print values in full.","to":"-1 means log values in full."}},"from":"17","status":"changed","to":"18"}],"content_hash":"028cd607339b8ebca7f52d97a46e537e221c9b53c9abfc2202e25ffe9b48a777","context":"","default_changed_in":[],"default_history":[{"from":"13","to":"19","value":"-1 B"}],"editorial":{"advice":{"olap":"Analytical parameters can be large arrays or predicates; use a bounded positive limit for a short diagnostic window rather than -1, and verify logs remain useful after truncation.","oltp":"Keep zero when Bind values may contain credentials or regulated data. If diagnostics require values, choose the smallest useful positive limit and measure binary-bind conversion cost under peak OLTP traffic.","small":"Use zero by default. Full values consume disk and conversion CPU that a small node cannot absorb safely, and truncation is not redaction."},"mechanism":["log_parameter_max_length controls Bind values attached to non-error statement-logging messages. Zero suppresses them, -1 allows full values, and a positive byte count truncates each textual value to that limit.","It applies to messages produced by log_statement, log_min_duration_statement, and related statement-logging settings. Any nonzero value adds work; parameters sent in binary form must be converted to text before they can be logged.","It is a SUPERUSER-context session setting and is independent of log_parameter_max_length_on_error. The normal and error paths therefore need separate confidentiality and overhead decisions."],"pitfalls":["Using -1 and exposing complete credentials, tokens, or large payloads in normal statement logs.","Treating truncation as redaction; a sensitive prefix can remain fully visible.","Ignoring text-conversion overhead for binary Bind parameters when the value is nonzero.","Assuming this setting also limits error-path parameters controlled by log_parameter_max_length_on_error."],"references":[{"title":"PostgreSQL 19 Beta 4: log_parameter_max_length","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-PARAMETER-MAX-LENGTH"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_statement","log_duration","log_connections","log_disconnections","log_parameter_max_length_on_error"],"summary":"log_parameter_max_length is the PostgreSQL setting that defines the maximum length in bytes of data logged for bind parameter values when logging statements."},"enumvals":[],"first_version":"13","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.390915+08:00","intro_commit":{"authored_at":"2020-04-02T15:04:51-04:00","discussion":["https://postgr.es/m/b10493cc-a399-a03a-67c7-068f2791ee50@imap.cc"],"hash":"0b34e7d307e6a142ee94800e6d5f3e73449eeffd","subject":"Improve user control over truncation of logged bind-parameter values.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=0b34e7d307e6a142ee94800e6d5f3e73449eeffd"},"key":"log_parameter_max_length","last_version":"20","max_val":"","min_val":"","name":"log_parameter_max_length","position":237,"present_in":["13","14","15","16","17","18","19","20"],"short_desc":"If greater than zero, each bind parameter value logged with a non-error statement-logging message is trimmed to this many bytes.","short_desc_zh":"","source_rev":"english-manuals:e17e5d5237ab5d1b65b292bec1f64f645f9c44a22cc2dd63286ff5077671ef3e","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"log_parameter_max_length","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_parameter_max_length","SourceRevision":"english-manuals:e17e5d5237ab5d1b65b292bec1f64f645f9c44a22cc2dd63286ff5077671ef3e","Facts":{"boot_val":"-1","category":"Reporting and Logging / What to Log","context":"superuser","description":"If greater than zero, each bind parameter value logged with a non-error statement-logging message is trimmed to this many bytes. Zero disables logging of bind parameters for non-error statement logs. -1 (the default) allows bind parameters to be logged in full. If this value is specified without units, it is taken as bytes. Only superusers and users with the appropriate SET privilege can change this setting. This setting only affects log messages printed as a result of log_statement, log_min_duration_statement, and related settings. Non-zero values of this setting add some overhead, particularly if parameters are sent in binary form, since then conversion to text is required.","doc":{"anchor":"GUC-LOG-PARAMETER-MAX-LENGTH","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"-1 means log values in full.","lang":"en","max_val":"1073741823","metadata_version":"18","min_val":"-1","name":"log_parameter_max_length","short_desc":"Sets the maximum length in bytes of data logged for bind parameter values when logging statements.","source":"pg-settings-source-snapshot","unit":"B","vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-PARAMETER-MAX-LENGTH","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_parameter_max_length","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"log_parameter_max_length","Summary":"","BodyHTML":"\u003cp\u003e如果大于零，则记录在非错误语句日志消息中的每个绑定参数值都会被截断为指定的字节数。零表示禁用非错误语句日志中绑定参数的记录。\u003ccode\u003e-1\u003c/code\u003e（默认值）允许完整记录绑定参数。如果未指定单位，则默认为字节。只有超级用户和具有适当\u003ccode\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e\u003cp\u003e此设置仅影响由\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-STATEMENT\" rel=\"nofollow\"\u003elog_statement\u003c/a\u003e、\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT\" rel=\"nofollow\"\u003elog_min_duration_statement\u003c/a\u003e及相关设置产生的日志消息。此设置为非零值时会增加一些开销，特别是以二进制形式发送参数时，因为需要将参数转换为文本。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"4964f7caad3bac4af5b285f03f41c88c346911a400736e9e0823a512bc400dc5","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e如果大于零，则记录在非错误语句日志消息中的每个绑定参数值都会被截断为指定的字节数。零表示禁用非错误语句日志中绑定参数的记录。\u003ccode class=\"literal\"\u003e-1\u003c/code\u003e（默认值）允许完整记录绑定参数。如果未指定单位，则默认为字节。只有超级用户和具有适当\u003ccode class=\"literal\"\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e\u003cp\u003e此设置仅影响由\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-STATEMENT\"\u003elog_statement\u003c/a\u003e、\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT\"\u003elog_min_duration_statement\u003c/a\u003e及相关设置产生的日志消息。此设置为非零值时会增加一些开销，特别是以二进制形式发送参数时，因为需要将参数转换为文本。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
