3 ms·
Why and when would someone use executemany() instead? What kills you in this use case is roundtrips - send one row, wait for an acknowledgement (even if you ar
by gaius 9y ago
Why and when would someone use executemany() instead?
What kills you in this use case is roundtrips - send one row, wait for an acknowledgement (even if you are not committing it yet) then sent one more, and so on and so on. There is a lot of dead time spent in protocol overheads or just idle. A well implemented executemany() sends as many rows at a time as will fit in a network packet and keeps streaming them as fast as it can.