Optimize various aggregate deserialization functions
David Rowley <drowley@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/array_userfuncs.c | modified | +12 −12 |
| src/backend/utils/adt/numeric.c | modified | +24 −24 |
| src/backend/utils/adt/varlena.c | modified | +6 −6 |
Discussion
- Making aggregate deserialization (and WAL receive) functions slightly faster 28 messages · 2023-02-12 → 2023-11-07