]> git.ipfire.org Git - thirdparty/psycopg.git/commit
perf: load results by row rather than by column
authorJörg Breitbart <jerch@rockborn.de>
Thu, 16 Oct 2025 00:01:32 +0000 (02:01 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 18 Oct 2025 02:11:42 +0000 (04:11 +0200)
commitde7c4874f2bd35bdb4e34e01853a9a26eadb0cea
tree65addfc724af06ce9858a021e43489e89166b80d
parent65fe9d73cab7b377f73384f43ae11df2f8b4b35f
perf: load results by row rather than by column

In the past we were converting results to Python tuples proceeding
column by column. The rationale was that certain overhead such as
selecting the loader was to be paid only once per column, not once per
datum.

However this analysis was dismantled in #1163, see especially the comment at
https://github.com/psycopg/psycopg/pull/1163#issuecomment-3288921422
for some benchmark comparing various conversion strategies. In the end,
the simple row-by-row loading in a single function ends up being more
performing. Performance now surpasses the one of psycopg2.

See also #1155 for an initial analysis of performance regression.

A big thank you to Jörg Breitbart (@jerch) for this improvement!
docs/news.rst
psycopg_c/psycopg_c/_psycopg/transform.pyx