> Hi All, > > I'm testing an upgrade from Postgres 9.6.16 to 12.1 and seeing a > significant performance gain in one specific query. This is really great, > but I'm just looking to understand why.
pg12 reads half the number of buffers. I bet it's because of this change:
When asked for a slice of a TOAST entry, decompress enough to return the slice instead of decompressing the entire object.
For use cases where the slice is at, or near, the beginning of the entry, this avoids a lot of unnecessary decompression work.
This changes the signature of pglz_decompress() by adding a boolean to indicate if it's ok for the call to finish before consuming all of the source or destination buffers.