[PATCH] pg_convert improvement

Yurii Rashkovskii <yrashk@gmail.com>

From: Yurii Rashkovskii <yrashk@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2023-11-24T14:05:29Z
Lists: pgsql-hackers

Attachments

Hi,

I propose a patch that ensures `pg_convert` doesn't allocate and copy data
when no conversion is done. It is an unnecessary overhead, especially when
such conversions are done frequently and for large values.

I've tried measuring the performance impact, and the patched version has a
small but non-zero gain.

The patch builds against `master` and `make check` succeeds.

Happy to hear any feedback!

-- 
Y.

Commits

  1. Teach convert() and friends to avoid copying when possible.