Re: libpq: PQfnumber overload for not null-terminated strings

Поиск
Список
Период
Сортировка
От Ivan Trofimov
Тема Re: libpq: PQfnumber overload for not null-terminated strings
Дата
Msg-id 310dea21-cd4e-385e-d312-e6ea786836da@yandex.ru
обсуждение исходный текст
Ответ на Re: libpq: PQfnumber overload for not null-terminated strings  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Ответы Re: libpq: PQfnumber overload for not null-terminated strings  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Список pgsql-hackers
> 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.

Absolutely, you're right.

The problem here is not that it's impossible to write it in a performant 
way, but rather that it's impossible to do so in a performant _and_ 
clean way given the convenient abstractions wrapper-libraries provide: 
here's a `Result`, which consists of `Row`s, which in turn consist of 
`Field`s.
The most natural and straightforward way to iterate over a `Result` 
would be in the lines of that loop, and people do write code like that 
because it's what they expect to just work given the abstractions (and 
it does, it's just slow).
Caching the result of PQfnumber could be done, but would result in 
somewhat of a mess on a call-site.


I like your idea of 'PQfnumberRaw': initially i was only concerned about 
a null-terminated string requirement affecting my interfaces (because 
users complained about that to me, 
https://github.com/userver-framework/userver/issues/494), but I think 
PQfnumberRaw could solve both problems (PQfnumber being a bottleneck 
when called repeatedly and a null-terminated string requirement) 
simultaneously.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: [PATCH] updates to docs about HOT updates for BRIN
Следующее
От: vignesh C
Дата:
Сообщение: Re: Improve eviction algorithm in ReorderBuffer