v20250930-0022-try-LZ4_compress_fast.patch

text/x-patch

Filename: v20250930-0022-try-LZ4_compress_fast.patch
Type: text/x-patch
Part: 21
Message: Re: Proposal: Adding compression of temporary files

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v20250930-0022
Subject: try LZ4_compress_fast
File+
src/backend/storage/file/buffile.c 4 3
From ee08e8b8c6d0de57ce9c478afd1ce89aebafce94 Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@vondra.me>
Date: Tue, 30 Sep 2025 13:00:10 +0200
Subject: [PATCH v20250930 22/22] try LZ4_compress_fast

---
 src/backend/storage/file/buffile.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index 881fc44faa3..e3d4e2a342e 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -774,9 +774,10 @@ BufFileDumpBuffer(BufFile *file)
 					 * The length is stored at the beginning, we'll fill it in
 					 * at the end.
 					 */
-					cSize = LZ4_compress_default(file->buffer.data,
-												 cData + sizeof(CompressHeader),
-												 file->nbytes, cBufferSize);
+					cSize = LZ4_compress_fast(file->buffer.data,
+											  cData + sizeof(CompressHeader),
+											  file->nbytes, cBufferSize,
+											  10);	/* somewhat higher value */
 					if (cSize == 0)
 					{
 						ereport(ERROR,
-- 
2.51.0