{"Entry":{"collection":"guc","key":"default_toast_compression","name":"default_toast_compression","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Statement Behavior","category_zh":"","changed_in":["19"],"changes":[{"documentation_changed":false,"fields":{},"from":"13","status":"added","to":"14"},{"documentation_changed":true,"fields":{"boot_val":{"from":"pglz","to":"lz4"}},"from":"18","status":"changed","to":"19"}],"content_hash":"f9b372960f5c6f4009ccc20f1ab137218f4e5c52f63f9e42a30d93fb0effc0d4","context":"","default_changed_in":["19"],"default_history":[{"from":"14","to":"18","value":"pglz"},{"from":"19","to":"19","value":"lz4"}],"editorial":{"advice":{"olap":"LZ4 can favor faster compression and decompression when the build supports it, but measure actual compressibility and scan behavior before changing new-write policy.","oltp":"Benchmark pglz versus lz4 with representative wide values, update rates, CPU, WAL, and storage. Prefer explicit column COMPRESSION for important schemas over a surprising session default.","small":"Keep pglz unless CPU-versus-space measurements and package support justify lz4; changing the default does not recompress existing values."},"mechanism":["default_toast_compression sets the default compression method for compressible values. It chooses pglz or, when compiled in, lz4 for newly written compressible values; a column COMPRESSION clause overrides the session default.","default_toast_compression is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It supplies a default only when SQL omits an explicit choice, so schema migrations, object-level options, privileges, and later ALTER operations can override or outlive it."],"pitfalls":["Changing default_toast_compression in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Expecting a changed default to rewrite existing objects or override explicit DDL clauses.","Ignoring tablespace privileges, installed access methods or compression support, and restore portability.","Changing default_toast_compression globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: default_toast_compression","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-DEFAULT-TOAST-COMPRESSION"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["default_table_access_method","default_tablespace","temp_tablespaces","check_function_bodies","maintenance_work_mem"],"summary":"default_toast_compression is the PostgreSQL setting that defines the default compression method for compressible values."},"enumvals":[],"first_version":"14","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:31.10952+08:00","intro_commit":{"authored_at":"2021-03-19T15:10:38-04:00","discussion":["https://postgr.es/m/20170907194236.4cefce96%40wp.localdomain","https://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com"],"hash":"bbe0a81db69bd10bd166907c3701492a29aca294","subject":"Allow configurable LZ4 TOAST compression.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bbe0a81db69bd10bd166907c3701492a29aca294"},"key":"default_toast_compression","last_version":"20","max_val":"","min_val":"","name":"default_toast_compression","position":102,"present_in":["14","15","16","17","18","19","20"],"short_desc":"This variable sets the default TOAST compression method for values of compressible columns.","short_desc_zh":"","source_rev":"english-manuals:4ec3ba8e0350bb8921b8dc7c4f7a5bc486f8a07b413a104cdc1be4924cdda589","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"default_toast_compression","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"default_toast_compression","SourceRevision":"english-manuals:4ec3ba8e0350bb8921b8dc7c4f7a5bc486f8a07b413a104cdc1be4924cdda589","Facts":{"boot_val":"pglz","category":"Client Connection Defaults / Statement Behavior","context":"user","description":"This variable sets the default TOAST compression method for values of compressible columns. (This can be overridden for individual columns by setting the COMPRESSION column option in CREATE TABLE or ALTER TABLE.) The supported compression methods are pglz and (if PostgreSQL was compiled with --with-lz4) lz4. The default is pglz.","doc":{"anchor":"GUC-DEFAULT-TOAST-COMPRESSION","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":["pglz","lz4"],"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"default_toast_compression","short_desc":"Sets the default compression method for compressible values.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-DEFAULT-TOAST-COMPRESSION","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"default_toast_compression","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"default_toast_compression","Summary":"","BodyHTML":"\u003cp\u003e这个变量设置可压缩列的值所使用的默认\u003ca href=\"/docs/18/storage-toast.html\" rel=\"nofollow\"\u003eTOAST\u003c/a\u003e压缩方法。（可以在\u003ccode\u003eCREATE TABLE\u003c/code\u003e或\u003ccode\u003eALTER TABLE\u003c/code\u003e中为单独的列设置 \u003ccode\u003eCOMPRESSION\u003c/code\u003e列选项，从而覆盖该默认值。）支持的压缩方法有\u003ccode\u003epglz\u003c/code\u003e，以及（如果\u003cspan\u003ePostgreSQL\u003c/span\u003e编译时启用了\u003ccode\u003e--with-lz4\u003c/code\u003e）\u003ccode\u003elz4\u003c/code\u003e。默认值为\u003ccode\u003epglz\u003c/code\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"6fd0eadb7fd146d2f5793046440363e6247bc3e2188fb251a53ae0e89991f00e","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e这个变量设置可压缩列的值所使用的默认\u003ca href=\"/docs/18/storage-toast.html\" title=\"66.2. TOAST\"\u003eTOAST\u003c/a\u003e压缩方法。（可以在\u003ccode class=\"command\"\u003eCREATE TABLE\u003c/code\u003e或\u003ccode class=\"command\"\u003eALTER TABLE\u003c/code\u003e中为单独的列设置 \u003ccode class=\"literal\"\u003eCOMPRESSION\u003c/code\u003e列选项，从而覆盖该默认值。）支持的压缩方法有\u003ccode class=\"literal\"\u003epglz\u003c/code\u003e，以及（如果\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e编译时启用了\u003ccode class=\"option\"\u003e--with-lz4\u003c/code\u003e）\u003ccode class=\"literal\"\u003elz4\u003c/code\u003e。默认值为\u003ccode class=\"literal\"\u003epglz\u003c/code\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
