Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkEYQ-0003Bq-Ob for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 17:00:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkEYQ-0006Ms-Ap for pgsql-performance@arkaria.postgresql.org; Thu, 08 Oct 2015 17:00:30 +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 1ZkEYP-0006Me-RS for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 17:00:29 +0000 Received: from proofpoint2.mail.rice.edu ([128.42.201.101] helo=pp2.rice.edu) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZkEYM-0001t4-Qu for pgsql-performance@postgresql.org; Thu, 08 Oct 2015 17:00:28 +0000 Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.15.0.59/8.15.0.59) with SMTP id t98GrnGC023677; Thu, 8 Oct 2015 12:00:25 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1xaa2gbe7c-1; Thu, 08 Oct 2015 12:00:25 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.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 mh2.mail.rice.edu (Postfix) with ESMTP id 82B32500122; Thu, 8 Oct 2015 12:00:25 -0500 (CDT) Received: by aart.rice.edu (Postfix, from userid 18612) id 780E71008F9; Thu, 8 Oct 2015 12:00:25 -0500 (CDT) Date: Thu, 8 Oct 2015 12:00:25 -0500 From: "ktm@rice.edu" To: Carlo Cc: pgsql-performance@postgresql.org Subject: Re: One long transaction or multiple short transactions? Message-ID: <20151008170025.GE21291@aart.rice.edu> References: <002a01d0ffe4$2c630e60$85292b20$@stonebanks.ca> <003d01d0ffe4$9ae8f890$d0bae9b0$@stonebanks.ca> <00fe01d10159$8e731980$ab594c80$@stonebanks.ca> <012e01d101db$4081f7a0$c185e6e0$@stonebanks.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <012e01d101db$4081f7a0$c185e6e0$@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-1510080183 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 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. > 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. 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