cursor.executemany generates multiple INSERTs - Mailing list psycopg

From Idan Kamara
Subject cursor.executemany generates multiple INSERTs
Date
Msg-id CAMz0A7kFM+v5P7acsjGUa0odqj8heLvpe=vLU9ZDARu4Aivo8Q@mail.gmail.com
Whole thread Raw
Responses Re: cursor.executemany generates multiple INSERTs
List psycopg
Hi,

When using executemany to do a bulk insert, psycopg2 generates an
INSERT for each item in the given sequence of items.

This is a lot slower than a single INSERT using Postgres multirow
VALUES syntax, e.g.

INSERT INTO films (code, title, did, date_prod, kind) VALUES
    ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'),
    ('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');

Why doesn't psycopg2 use this syntax?


psycopg by date:

Previous
From: Neil Tiffin
Date:
Subject: Re: Trying to understand why same SQL returns different results.
Next
From: Daniele Varrazzo
Date:
Subject: Re: cursor.executemany generates multiple INSERTs