Re: libpq: PQfnumber overload for not null-terminated strings - Mailing list pgsql-hackers

From Jelte Fennema-Nio
Subject Re: libpq: PQfnumber overload for not null-terminated strings
Date
Msg-id CAGECzQQ_cEU+8VtHOMe=fCPaS6q5YW+8-ThmAFf3hpTH5s_+wQ@mail.gmail.com
Whole thread Raw
In response to Re: libpq: PQfnumber overload for not null-terminated strings  (Ivan Trofimov <i.trofimow@yandex.ru>)
Responses Re: libpq: PQfnumber overload for not null-terminated strings
List pgsql-hackers
On Tue, 27 Feb 2024 at 00:31, Ivan Trofimov <i.trofimow@yandex.ru> wrote:
> I see now that I failed to express myself clearly: it's not a per-query
> overhead, but rather a per-result-field one.

I'm fairly sympathetic to decreasing the overhead of any per-row
operation. And looking at the code, it doesn't surprise me that
PQfnumber shows up so big in your profile. I think it would probably
make sense to introduce a PQfnumber variant that does not do the
downcasing/quote handling (called e.g. PQfnumberRaw).

However, I do think you could convert this per-row overhead in your
case to per-query overhead by caching the result of PQfnumber for each
unique C++ string_view. Afaict that should solve your performance
problem.



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Synchronizing slots from primary to standby
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] updates to docs about HOT updates for BRIN