Re: Compressed TOAST Slicing

From: Andres Freund <andres(at)anarazel(dot)de>
To: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Владимир Лесков <vladimirlesk(at)yandex-team(dot)ru>, Stephen Frost <sfrost(at)snowman(dot)net>, Daniel Verite <daniel(at)manitou-mail(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, rafia(dot)sabih(at)enterprisedb(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Compressed TOAST Slicing
Date: 2019-04-09 17:20:49
Message-ID: 20190409172049.bnjseaylju3r6lf6@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-04-09 10:12:56 -0700, Paul Ramsey wrote:
>
> > On Apr 9, 2019, at 10:09 AM, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> >
> > He advised me to use algorithm that splits copied regions into smaller non-overlapping subregions with exponentially increasing size.
> >
> > while (off <= len)
> > {
> > memcpy(dp, dp - off, off);
> > len -= off;
> > dp += off;
> > off *= 2;
> > }
> > memcpy(dp, dp - off, len);
> >
> > On original Paul's test without patch of this thread this optimization gave about x2.5 speedup.
> > I've composed more detailed tests[0] and tested against current master. Now it only gives 20%-25% of decompression speedup, but I think it is still useful.
>
> Wow, well beyond slicing, just being able to decompress 25% faster is a win for pretty much any TOAST use case. I guess the $100 question is: portability? The whole reason for the old-skool code that’s there now was concerns about memcpy’ing overlapping addresses and Bad Things happening.

Just use memmove? It's usually as fast these days.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2019-04-09 17:28:14 Re: Compressed TOAST Slicing
Previous Message Andrey Borodin 2019-04-09 17:17:50 Re: Compressed TOAST Slicing