Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkIzn-0000ag-71 for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 21:45:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkIzm-0003lT-4E for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 21:45:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZkIy7-0001s7-Ps for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 21:43:20 +0000 Received: from sub5.mail.dreamhost.com ([208.113.200.129] helo=homiemail-a79.g.dreamhost.com) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZkIy4-0007tk-Kp for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 21:43:18 +0000 Received: from homiemail-a79.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a79.g.dreamhost.com (Postfix) with ESMTP id 304F97D406F for ; Thu, 8 Oct 2015 14:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=stonebanks.ca; h=from:to :references:in-reply-to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=stonebanks.ca; bh=FOG uYDXbLAWEUiNef5ZdlCy22HI=; b=NjWf80yJQ++W6ctAa0izPc4HNfxp992qPYt pgWjj/mNZ5p/+Gv+d8KPJNUCzS7mxKqYP2EyXe4aBMJIDmll7waerzasYuDs9pPG pAO6XfcXbj565oehqoYTwbdyDuwGQ5B63WJgJQ4TZs/leA5UNNPUwRw89TOg56NW YwKNtLUM= Received: from CAPRICA (modemcable216.122-161-184.mc.videotron.ca [184.161.122.216]) (Authenticated sender: carlo@stonebanks.ca) by homiemail-a79.g.dreamhost.com (Postfix) with ESMTPA id D2E8E7D406E for ; Thu, 8 Oct 2015 14:43:14 -0700 (PDT) From: "Carlo" To: References: <002a01d0ffe4$2c630e60$85292b20$@stonebanks.ca> <003d01d0ffe4$9ae8f890$d0bae9b0$@stonebanks.ca> <00fe01d10159$8e731980$ab594c80$@stonebanks.ca> <012e01d101db$4081f7a0$c185e6e0$@stonebanks.ca> <20151008170025.GE21291@aart.rice.edu> In-Reply-To: <20151008170025.GE21291@aart.rice.edu> Subject: Re: One long transaction or multiple short transactions? Date: Thu, 8 Oct 2015 17:43:11 -0400 Message-ID: <014b01d10212$55466a40$ffd33ec0$@stonebanks.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFD1GuMjlYKSpoTBolbgZAO1EVkoAHr5u6yAbJNYmcBi2BbYgEy+PeOAiE2RY4CLPGbZ58nIgMA Content-Language: en-ca X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org -----Original Message----- From: ktm@rice.edu [mailto:ktm@rice.edu] Sent: October 8, 2015 1:00 PM To: Carlo Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] One long transaction or multiple short transactions? On Thu, Oct 08, 2015 at 11:08:55AM -0400, Carlo wrote: > >> Sounds like a locking problem > > This is what I am trying to get at. The reason that I am not > addressing hardware or OS configuration concerns is that this is not > my environment, but my client's. The client is running my import > software and has a choice of how long the transactions can be. They > are going for long transactions, and I am trying to determine whether > there is a penalty for single long transactions over a configuration > which would allow for more successive short transactions. (keep in mind all reads and writes are single-row). > > There are other people working on hardware and OS configuration, and > that's why I can't want to get into a general optimization discussion > because the client is concerned with just this question. > On October 8, 2015 1:00 PM Ken wrote: > Hi Carlo, > Since the read/writes are basically independent, which is what I take your "single-row" comment to mean, by batching them you are balancing two > opposing factors. First, larger batches allow you to consolodate I/O and other resource requests to make them more efficient per row. Second, larger > batches require more locking as the number of rows updated grows. It may very well be the case that by halving your batch size that the system can > process them more quickly than a single batch that is twice the size. Just to clarify, one transaction of this type may take longer to commit than two successive transactions of half the size? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance