From: | Gavin Roy <gavinr(at)aweber(dot)com> |
---|---|
To: | "Godfrin, Philippe E" <Philippe(dot)Godfrin(at)nov(dot)com> |
Cc: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Inserts and bad performance |
Date: | 2021-11-24 19:50:16 |
Message-ID: | CAFVAjJEnQckKN8aLW=Oc8wDOB9+pKVJYhA_h3QxyYikzFMz-vg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Nov 24, 2021 at 2:15 PM Godfrin, Philippe E <
Philippe(dot)Godfrin(at)nov(dot)com> wrote:
> Greetings
>
> I am inserting a large number of rows, 5,10, 15 million. The python code
> commits every 5000 inserts. The table has partitioned children.
>
On the Python client side, if you're using psycopg, you should consider
using using COPY instead of INSERT if you're not:
https://www.psycopg.org/psycopg3/docs/basic/copy.html#copy
And if using psycopg2, execute_batch might be of value:
https://www.psycopg.org/docs/extras.html?highlight=insert#psycopg2.extras.execute_batch
Regards,
Gavin
From | Date | Subject | |
---|---|---|---|
Next Message | Godfrin, Philippe E | 2021-11-24 19:59:38 | RE: [EXTERNAL] Re: Inserts and bad performance |
Previous Message | Tom Lane | 2021-11-24 19:31:53 | Re: Inserts and bad performance |