public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael P. McDonnell <[email protected]>
To: [email protected]
Subject: Consecutive Inserts Freeze Execution of Psycopg3
Date: Sun, 23 Apr 2023 15:45:56 -0500
Message-ID: <CAHmCLHrztOYi=uLqc6jKrytz5=e4ZKhYP1LTyLfTi-KGC1pR9w@mail.gmail.com> (raw)
Python 3.10.6
psycopg library 3.1.8
Running consecutive inserts sourced in files.
All inserts are of the same format:
INSERT INTO _____ (field1, field2, field3)
SELECT field1, field2, field3 FROM ____, Join ___, join ___ etc...
The code I've written is this:
for qi in range(qlen):
query = queries[qi]
qparams = params[qi]
with self.connection.cursor() as conn:
conn.execute(query, qparams)
When I run the queries in dbeaver - the first query takes 120s (it's 1.9M
rows), the second query takes 2s (7000 rows).
When I run the queries in python - it freezes on the second query.
Any guidance on how to attack this would be awesome as I have re-written my
code a dozen times and am just slinging mud to see what sticks.
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Consecutive Inserts Freeze Execution of Psycopg3
In-Reply-To: <CAHmCLHrztOYi=uLqc6jKrytz5=e4ZKhYP1LTyLfTi-KGC1pR9w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox