Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkJFW-0001Tu-2D for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 22:01:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkJFV-00008D-E9 for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 22:01:17 +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 1ZkJDr-0006dQ-La for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 21:59:35 +0000 Received: from proofpoint1.mail.rice.edu ([128.42.201.100] helo=pp1.rice.edu) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZkJDo-0008De-Ex for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 21:59:33 +0000 Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.15.0.59/8.15.0.59) with SMTP id t98Lwg2n025800; Thu, 8 Oct 2015 16:59:31 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp1.rice.edu with ESMTP id 1xdw8cg7gx-1; Thu, 08 Oct 2015 16:59:31 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel X-SMTP-Auth: no X-SMTP-Auth: no Received: from aart.rice.edu (aart.rice.edu [168.7.56.48]) by mh3.mail.rice.edu (Postfix) with ESMTP id E6E8B40134; Thu, 8 Oct 2015 16:59:30 -0500 (CDT) Received: by aart.rice.edu (Postfix, from userid 18612) id DC3F0100927; Thu, 8 Oct 2015 16:59:30 -0500 (CDT) Date: Thu, 8 Oct 2015 16:59:30 -0500 From: "ktm@rice.edu" To: Carlo Cc: pgsql-performance@postgresql.org Subject: Re: One long transaction or multiple short transactions? Message-ID: <20151008215930.GM21291@aart.rice.edu> 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> <014b01d10212$55466a40$ffd33ec0$@stonebanks.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <014b01d10212$55466a40$ffd33ec0$@stonebanks.ca> User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.9 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1510080218 X-Pg-Spam-Score: -4.2 (----) 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 On Thu, Oct 08, 2015 at 05:43:11PM -0400, Carlo wrote: > -----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? > Yes, but where the optimum count is located should be determined by testing. Just varying the batch size and note where the performance is at a maximum. Regards, Ken -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance