From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Optimize partial TOAST decompression
Date: Tue, 01 Oct 2019 12:31:12 +0000
Message-ID: <E1iFHJA-0004dK-JD@gemulon.postgresql.org> (raw)
Optimize partial TOAST decompression
Commit 4d0e994eed added support for partial TOAST decompression, so the
decompression is interrupted after producing the requested prefix. For
prefix and slices near the beginning of the entry, this may saves a lot
of decompression work.
That however only deals with decompression - the whole compressed entry
was still fetched and re-assembled, even though the compression used
only a small fraction of it. This commit improves that by computing how
much compressed data may be needed to decompress the requested prefix,
and then fetches only the necessary part.
We always need to fetch a bit more compressed data than the requested
(uncompressed) prefix, because the prefix may not be compressible at all
and pglz itself adds a bit of overhead. That means this optimization is
most effective when the requested prefix is much smaller than the whole
compressed entry.
Author: Binguo Bao
Reviewed-by: Andrey Borodin, Tomas Vondra, Paul Ramsey
Discussion: https://www.postgresql.org/message-id/flat/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail....
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/11a078cf87ffb611d19c7dec6df68b41084ad9c9
Modified Files
--------------
src/backend/access/common/detoast.c | 54 ++++++++++++++++++++++++++++++------
src/common/pg_lzcompress.c | 37 ++++++++++++++++++++++++
src/include/access/toast_internals.h | 1 +
src/include/common/pg_lzcompress.h | 2 ++
4 files changed, 86 insertions(+), 8 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tomas.vondra@postgresql.org
Subject: Re: pgsql: Optimize partial TOAST decompression
In-Reply-To: <E1iFHJA-0004dK-JD@gemulon.postgresql.org>
References: <E1iFHJA-0004dK-JD@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox