Replies: 2 comments 1 reply
-
Hello @amachanic there are limitations not so much in the wire protocol, but in the server itself. When you run a query, you will get the whole response back from the server. There might be a few workarounds using psycopg3:
If you try any of these solution with psycopg3 we would be interested in feedback. Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
just curious -- is the performance impact you'd get from tuning down cursor.itersize only down to an increase in the number of round-trips? I've got a 100M+ row table that I need to load into a graph structure (using |
Beta Was this translation helpful? Give feedback.
-
Hello, this is more a background question than an actual issue - apologies if this isn't the right place for this sort of thing.
In psycopg2, if I select a large number of rows, psycopg2 will internally buffer them prior to my being able to consume them (i.e. by iterating over the output cursor). This has caused some major problems when selecting back many millions of rows. The workaround I've found is to create a named server-side cursor and tune down the itersize parameter, but this seems to have some negative implications from a performance perspective.
So my question is, can we expect improvements in this area in psycopg3? Is the current implementation necessary due to some Postgres wire protocol limitation, or is this something that can potentially be made better?
Thanks for any insights you can provide here, and for your work on this project. I'm excited to see what you do with it, regardless of whether or not this scenario happens to be solved.
Beta Was this translation helpful? Give feedback.
All reactions