From: Tom Lane <tgl@sss.pgh.pa.us>
To: Godfrin, Philippe E <Philippe.Godfrin@nov.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Inserts and bad performance
Date: Wed, 24 Nov 2021 14:31:53 -0500
Message-ID: <185058.1637782313@sss.pgh.pa.us> (raw)
In-Reply-To: <SA0PR15MB3933E7B425ADC5DC36D9A8CC82619@SA0PR15MB3933.namprd15.prod.outlook.com>
References: <SA0PR15MB3933E7B425ADC5DC36D9A8CC82619@SA0PR15MB3933.namprd15.prod.outlook.com>
"Godfrin, Philippe E" <Philippe.Godfrin@nov.com> writes:
> I am inserting a large number of rows, 5,10, 15 million. The python code commits every 5000 inserts. The table has partitioned children.
> At first, when there were a low number of rows inserted, the inserts would run at a good clip - 30 - 50K inserts per second. Now, after inserting oh say 1.5 Billion rows, the insert rate has dropped to around 5000 inserts per second. I dropped the unique index , rebuilt the other indexes and no change. The instance is 16 vcpu and 64GB ram.
Can you drop the indexes and not rebuild them till after the bulk load is
done? Once the indexes exceed available RAM, insert performance is going
to fall off a cliff, except maybe for indexes that are receiving purely
sequential inserts (so that only the right end of the index gets touched).
Also see
https://www.postgresql.org/docs/current/populate.html
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, Philippe.Godfrin@nov.com
Subject: Re: Inserts and bad performance
In-Reply-To: <185058.1637782313@sss.pgh.pa.us>
References: <SA0PR15MB3933E7B425ADC5DC36D9A8CC82619@SA0PR15MB3933.namprd15.prod.outlook.com> <185058.1637782313@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox