Re: Compressed TOAST Slicing - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Compressed TOAST Slicing
Date
Msg-id 20181101212915.GJ4184@tamriel.snowman.net
Whole thread Raw
In response to Compressed TOAST Slicing  (Paul Ramsey <pramsey@cleverelephant.ca>)
Responses Re: Compressed TOAST Slicing
List pgsql-hackers
Greetings,

* Paul Ramsey (pramsey@cleverelephant.ca) wrote:
> The attached patch adds in a code path to do a partial decompression of the
> TOAST entry, when the requested slice is at the start of the object.

Neat!

> As usual, doing less work is faster.

Definitely.

> Interesting note to motivate a follow-on patch: the substr() function does
> attempt to slice, but the left() function does not. So, if this patch is
> accepted, next patch will be to left() to add slicing behaviour.

Makes sense to me.

There two things that I wonder about in the patch- if it would be of any
use to try and allocate on a need basis instead of just allocating the
whole chunk up to the toast size, and secondly, why we wouldn't consider
handling a non-zero offset.  A non-zero offset would, of course, still
require decompressing from the start and then just throwing away what we
skip over, but we're going to be doing that anyway, aren't we?  Why not
stop when we get to the end, at least, and save ourselves the trouble of
decompressing the rest and then throwing it away.

> If nobody lights me on fire, I'll submit to commitfest shortly.

Sounds like a good idea to me.

Thanks!

Stephen

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PG vs macOS Mojave
Next
From: Magnus Hagander
Date:
Subject: Re: CF app feature request