Re:Differences from Psycopg2
by FreakLegion on Tuesday October 10, 2023 @03:52PM
(#37836630)
Asyncpg isn't pure Python, if that's what you mean by native. It's a heavy user of Python's C API, which is why PyPy can't run it. But yes, Asyncpg does tend to be quite a bit faster than Psycopg2 in most cases.
[ Parent
| on HN ]
Re:Differences from Psycopg2
by andrewstuart on Tuesday October 10, 2023 @04:13PM
(#37836867)
OK I was wrong and stand corrected, asyncpg is not pure Python.
asyncpg has these two C files and also uses Cython as far as I can see.
https://github.com/MagicStack/asyncpg/blob/master/asyncpg/pr...
https://github.com/MagicStack/asyncpg/blob/master/asyncpg/pr...
If you are interested here is a post by the psycopg author about psycopg2 and 3 and performance versus asyncpg.
https://www.varrazzo.com/blog/2020/05/19/a-trip-into-optimis...