Re: [HACKERS] Custom compression methods

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, David Steele <david(at)pgmasters(dot)net>, Ildus Kurbangaliev <i(dot)kurbangaliev(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [HACKERS] Custom compression methods
Date: 2021-03-16 13:05:21
Message-ID: CAFiTN-ukmNS3E1dhHVrCLXOHwyfq5b47LiVEz2wKrTCE=LW+zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 16, 2021 at 4:07 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> INSERT TIME
> Head: 17418.299 ms Patch: 20956.231 ms
>
> CTAS TIME:
> Head: 12837.872 ms Patch: 16775.739 ms

On quick analysis with perf it appeared that the performance is
degrading because of deforming

- 16.19% 3.54% postgres postgres [.]
CompareCompressionMethodAndDecompress
- 12.65% CompareCompressionMethodAndDecompress
- 12.57% slot_getallattrs
- 12.56% slot_getsomeattrs
- 12.53% slot_getsomeattrs_int
- 12.50% tts_buffer_heap_getsomeattrs
slot_deform_heap_tuple

So I think in the case of direct insert it needs to deform because I
am calling CompareCompressionMethodAndDecompress after ExecCopySlot
and that is why we have to deform every time so maybe that can be
avoided by calling CompareCompressionMethodAndDecompress before
ExecCopySlot. But in the case of CTAS or INSERT INTO SELECT we can
not avoid deforming because we might get the formed tuple from the
source table. I put a temporary hack to keep the map of the varlena
attribute and use it across the tuple but it did not improve the
performance in this case because the main bottleneck is
slot_getallattrs. I think this should help where we don't have any
varlena, but first I need to test whether we can any performance
regression in those cases at all.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Finnerty 2021-03-16 13:33:34 Re: Nondeterministic collations and the value returned by GROUP BY x
Previous Message vignesh C 2021-03-16 12:52:31 Re: [HACKERS] logical decoding of two-phase transactions