Re: Optimize partial TOAST decompression
Binguo Bao <djydewang@gmail.com>
From: Binguo Bao <djydewang@gmail.com>
To: Paul Ramsey <pramsey@cleverelephant.ca>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>,
Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-07-03T16:06:13Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Properly determine length for on-disk TOAST values
- 2dc08bd6179d 13.0 landed
-
Blind attempt to fix pglz_maximum_compressed_size
- 540f31680913 13.0 landed
-
Optimize partial TOAST decompression
- 11a078cf87ff 13.0 landed
Attachments
- 0001-Optimize-partial-TOAST-decompression-4.patch (text/x-patch) patch 0001
Paul Ramsey <pramsey@cleverelephant.ca> 于2019年7月2日周二 下午10:46写道: > This looks good to me. A little commentary around why > pglz_maximum_compressed_size() returns a universally correct answer > (there's no way the compressed size can ever be larger than this > because...) would be nice for peasants like myself. > > If you're looking to continue down this code line in your next patch, > the next TODO item is a little more involved: a user-land (ala > PG_DETOAST_DATUM) iterator API for access of TOAST datums would allow > the optimization of searching of large objects like JSONB types, and > so on, where the thing you are looking for is not at a known location > in the object. So, things like looking for a particular substring in a > string, or looking for a particular key in a JSONB. "Iterate until you > find the thing." would allow optimization of some code lines that > currently require full decompression of the objects. > > P. > Thanks for your comment. I've updated the patch. As for the iterator API, I've implemented a de-TOAST iterator actually[0]. And I’m looking for more of its application scenarios and perfecting it. Any comments would be much appreciated. Best Regards, Binguo Bao. [0] https://www.postgresql.org/message-id/flat/CAL-OGks_onzpc9M9bXPCztMofWULcFkyeCeKiAgXzwRL8kXiag@mail.gmail.com