Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpxoW-000103-9v for pgsql-general@arkaria.postgresql.org; Wed, 24 Nov 2021 19:20:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpxoV-0005GD-4d for pgsql-general@arkaria.postgresql.org; Wed, 24 Nov 2021 19:20:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpxoU-0005F1-Px for pgsql-general@lists.postgresql.org; Wed, 24 Nov 2021 19:20:14 +0000 Received: from aart.rice.edu ([168.7.56.48]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpxoQ-000166-UJ for pgsql-general@lists.postgresql.org; Wed, 24 Nov 2021 19:20:13 +0000 Received: by aart.rice.edu (Postfix, from userid 18612) id 1F2B4427F342; Wed, 24 Nov 2021 13:20:10 -0600 (CST) Date: Wed, 24 Nov 2021 13:20:10 -0600 From: Kenneth Marshall To: "Godfrin, Philippe E" Cc: "pgsql-general@lists.postgresql.org" Subject: Re: Inserts and bad performance Message-ID: <20211124192010.GB8058@aart.rice.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 24, 2021 at 07:15:31PM +0000, Godfrin, Philippe E 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. > > 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. > > I'm perplexed, I can't see to find any reason for the slow down... > Thanks, > pg Hi, With not much information, it may be I/O related. CPU and RAM cannot fix that once items need to be written to disk. Are there any errors in the logs or CPUs maxxed out? Regards, Ken