pgsql: Optimize various aggregate deserialization functions

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Optimize various aggregate deserialization functions
Date: 2023-10-09 04:25:39
Message-ID: E1qphpq-000joR-Kq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Optimize various aggregate deserialization functions

The serialized representation of an internal aggregate state is a bytea
value. In each deserial function, in order to "receive" the bytea value
we appended it onto a short-lived StringInfoData using
appendBinaryStringInfo. This was a little wasteful as it meant having to
palloc memory, copy a (possibly long) series of bytes then later pfree
that memory. Instead of going to this extra trouble, we can just fake up
a StringInfoData and point the data directly at the bytea's payload. This
should help increase the performance of internal aggregate
deserialization.

Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/CAApHDvr=e-YOigriSHHm324a40HPqcUhSp6pWWgjz5WwegR=cQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/608fd198def5390c3490bfe903730207dfd8eeb4

Modified Files
--------------
src/backend/utils/adt/array_userfuncs.c | 24 ++++++++---------
src/backend/utils/adt/numeric.c | 48 ++++++++++++++++-----------------
src/backend/utils/adt/varlena.c | 12 ++++-----
3 files changed, 42 insertions(+), 42 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-10-09 08:52:41 pgsql: Allocate Backend structs in PostmasterContext.
Previous Message Amit Kapila 2023-10-09 03:58:41 pgsql: Remove duplicate words in docs and code comments.