Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssOnP-0089zK-E9 for pgsql-general@arkaria.postgresql.org; Sun, 22 Sep 2024 15:46:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ssOnO-007vZr-Ng for pgsql-general@arkaria.postgresql.org; Sun, 22 Sep 2024 15:46:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssOnN-007vZh-CI for pgsql-general@lists.postgresql.org; Sun, 22 Sep 2024 15:46:46 +0000 Received: from fout8-smtp.messagingengine.com ([103.168.172.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssOnH-000WeU-W9 for pgsql-general@lists.postgresql.org; Sun, 22 Sep 2024 15:46:44 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 6DE0E1380109; Sun, 22 Sep 2024 11:46:38 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Sun, 22 Sep 2024 11:46:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727019998; x=1727106398; bh=msjc7COaJAyKIFgAFTMR1rKi/hu3L7y5aeaOnuFiFso=; b= rfWDCtWEEBBlUX17daE2l9UwIDz2vPl+C9PxXwdQZADe9/T426rAVDY6mu7htg6q QviOuxnSuWNtFQRRjykR08XdapVHF5CVGDHOxXu4+BkHFkS6fe3xD4ix7peATOkd 5xmLOmBRh3ijOZp7lDLWdY45C/jiBaM82DJV7Z97ePN5ekOjJL4bq4aoDv94Dg8r 5327fI8XXU5aLtqIU/ja+dSDuHSAaD0pSQ1hNS3A+rt5e22ava+YJcKL5/AxnTav ExavU056f4ybhN3WIZzoFNX39MRD0QGwWx7QYw3HQeBEtMDvR+YxajwDDeTKmk9X OzCeGxB80Zdr3pJkJjXmmw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727019998; x= 1727106398; bh=msjc7COaJAyKIFgAFTMR1rKi/hu3L7y5aeaOnuFiFso=; b=a Q6ZTyOIM7nr7ZEOxqKcUZKS9msn3qgOQ+hwKmSULuShyLoZNCi2gQ8SwDNkyJzW5 jdpDFGybb88eziSz33a+4CFGGflkx3vmaSxkl7kTFzeC5U2BLQq/6WBSKsC9SMsz FoOLqOpVx9uSPSFc0kIigl0iDWOffv2Rp8ViOiyNWvErMgqYD4QQ7IniFYMQYZFU Hh9iZIFUgltaCbPkOzzEe2XMiIaxlSHaP1whyNzXJn0r9aLB0mDaC+R1UmmCK5JB Ph75tlwyerZ6OK+3zf/yON1t0aIPqoxJXi58De4PCWlqO0yOIZgcOOTYzChcB52c yHx/GLT07NRe4mxscFO3Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeljedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgv rhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrg htthgvrhhnpeefgeefieeutdfggfetgefgheekjeehteeileeigfetieekjedvieeviefg heevtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthho pedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlohhknhgrthhhrdejfeesgh hmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhs rdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 22 Sep 2024 11:46:37 -0400 (EDT) Message-ID: Date: Sun, 22 Sep 2024 08:46:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How batch processing works To: Lok P Cc: pgsql-general@lists.postgresql.org References: <4178E73A-24F5-4E3C-92F6-1532D8102C3E@kleczek.org> <20240921143629.t2x37xfczeeunpnf@hjp.at> <2fe0be15-f64e-465c-9dd2-b55c559ac7e2@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/21/24 22:21, Lok P wrote: > > > On Sun, Sep 22, 2024 at 12:46 AM Adrian Klaver > > wrote: > > > > Thank you. So if I get it correct, if the client app(from which the data > is getting streamed/inserted) is in the same data center/zone as the > database (which is most of the time the case) then the batch insert does > not appear to be much beneficial. No, the point is that once the client and the database are not on the same machine the network that they communicate across becomes a consideration. In a contrived example the client could be in the same same data center as the database server and talking to the server via a dialup modem and the data transfer would be worse then the same client talking to a database server a 1000 miles away across a fiber optic connection. This gets back to plan --> test. /|\ | | <-- \|/ > > Which also means , people here were afraid of having triggers in such a > high dml table as because this will make the "batch insert" > automatically  converted into "row by row" behind the scene, but > considering the above results, it looks fine to go with a row by row > approach (but just having batch commit in place in place of row by row > commit). And not to worry about implementing the true batch insert > approach as that is not making a big difference here in data load > performance. This is getting ahead of the game. The immediate issue is the deadlock issues with the concurrent sessions and duplicate data. -- Adrian Klaver adrian.klaver@aklaver.com