Re: [psycopg] speed concerns with executemany()
От | Adrian Klaver |
---|---|
Тема | Re: [psycopg] speed concerns with executemany() |
Дата | |
Msg-id | 3404212c-a57c-776d-1ac7-9bb7e16f0bb3@aklaver.com обсуждение исходный текст |
Ответ на | Re: [psycopg] speed concerns with executemany() (Daniele Varrazzo <daniele.varrazzo@gmail.com>) |
Ответы |
Re: [psycopg] speed concerns with executemany()
|
Список | psycopg |
On 12/23/2016 05:09 PM, Daniele Varrazzo wrote: > On Sat, Dec 24, 2016 at 2:05 AM, Adrian Klaver > <adrian.klaver@aklaver.com> wrote: > >> I have to go with Christophe's explanation. They are seeing the effects of >> 200 separate transactions, though like he stated later this more an >> assumption then something I have tested. > > My wild wild wild assumption is that they have a trigger on the table > that gets triggered 200 times instead of one. > > The only thing I am sure of is that psycopg doesn't use any BEGIN > specifically in executemany. I see that now: In [5]: val_list = [(1, 2, 3), (4, 5, 6), (7, 8, 9)] In [12]: sql = "INSERT INTO psycopg_table VALUES(%s, %s, %s)" In [16]: con.set_session(autocommit=True) In [17]: cur = con.cursor() In [18]: cur.executemany(sql, val_list) [unknown]-2016-12-23 17:17:10.829 PST-0 LOG: connection received: host=::1 port=37352 aklaver-2016-12-23 17:17:10.830 PST-0 LOG: connection authorized: user=aklaver database=production aklaver-2016-12-23 17:17:35.373 PST-0 LOG: statement: INSERT INTO psycopg_table VALUES(1, 2, 3) aklaver-2016-12-23 17:17:35.416 PST-0 LOG: statement: INSERT INTO psycopg_table VALUES(4, 5, 6) aklaver-2016-12-23 17:17:35.457 PST-0 LOG: statement: INSERT INTO psycopg_table VALUES(7, 8, 9) Yet the data was available immediately in another session without a explicit COMMIT, so how is psycopg2 committing the INSERTs? > > > -- Daniele > -- Adrian Klaver adrian.klaver@aklaver.com
В списке psycopg по дате отправления: