Re: detoast datum into the given buffer as a optimization.

Andy Fan <zhihuifan1213@163.com>

From: Andy Fan <zhihuifan1213@163.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, David Rowley <dgrowley@gmail.com>, Tomas Vondra <tomas@vondra.me>
Date: 2024-10-29T06:45:58Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Avoid detoast in texteq/textne/byteaeq/byteane for unequal-length strings.

Attachments

Hi,

I find some independent improvement in this area. In the detoast_attr,
VARATT_IS_EXTERNAL_ONDISK and VARATT_IS_EXTERNAL_INDIRECT are checked
first, and then VARATT_IS_EXTERNAL_EXPANDED is checked. However when
VARATT_IS_EXTERNAL_EXPANDED is true, detoast_external_attr is called
which would check the previous two cases again. The attached patch uses
a more specific code to handle this.

This would not only remove such the double check overhead, but also make
my following patch easier since I don't need to build a
detoast_external_attr_[buffer] function.  

'make check-world' passed.

-- 
Best Regards
Andy Fan