Re: Optimize partial TOAST decompression - Mailing list pgsql-hackers

From Andrey Borodin
Subject Re: Optimize partial TOAST decompression
Date
Msg-id 7B7E4A05-F404-4083-B7F2-267869EE2910@yandex-team.ru
Whole thread Raw
In response to Optimize partial TOAST decompression  (Binguo Bao <djydewang@gmail.com>)
Responses Re: Optimize partial TOAST decompression
List pgsql-hackers
Hi, Binguo!

> 2 июня 2019 г., в 19:48, Binguo Bao <djydewang@gmail.com> написал(а):
>
> Hi, hackers!
....
> This seems to have a 10x improvement. If the number of toast data chunks is more, I believe that patch can play a
greaterrole, there are about 200 related TOAST data chunks for each entry in the case. 

That's really cool that you could produce meaningful patch long before end of GSoC!

I'll describe what is going on a little:
1. We have compressed value, which resides in TOAST table.
2. We want only some fraction of this value. We want some prefix with length L.
3. Previously Paul Ramsey submitted patch that omits decompression of value beyond desired L bytes.
4. Binguo's patch tries to do not fetch compressed data which will not bee needed to decompressor. In fact it fetches L
bytesfrom TOAST table. 

This is not correct: L bytes of compressed data do not always can be decoded into at least L bytes of data. At worst we
haveone control byte per 8 bytes of literal bytes. This means at most we need (L*9 + 8) / 8 bytes with current pglz
format.

Also, I'm not sure you use SET_VARSIZE_COMPRESSED correctly...

Best regards, Andrey Borodin.


pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Code comment change
Next
From: Thomas Munro
Date:
Subject: Re: Code comment change