Commit 14ae09c
Reuse a zstd compression context for WAL compression
XLogCompressBackupBlock() called ZSTD_compress(), which creates and
destroys a ZSTD_CCtx on every call. At the default compression level
that context is about 1.3MB, so wal_compression = zstd paid for one
allocation per full-page image, and a record can carry up to
XLR_MAX_BLOCK_ID + 1 of them.
Create it on first use and keep it for the life of the backend,
compressing with ZSTD_compressCCtx(), which is otherwise equivalent and
produces identical output. A statement logging 48k full-page images gets
about 12% faster.
Author: Andrey Borodin1 parent db0c984 commit 14ae09c
1 file changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
1064 | 1078 | | |
1065 | 1079 | | |
1066 | 1080 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1071 | 1093 | | |
1072 | 1094 | | |
1073 | 1095 | | |
| |||
0 commit comments