X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 93129D84C3 for ; Wed, 28 Sep 2005 09:54:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97000-10 for ; Wed, 28 Sep 2005 12:53:46 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id F4006D9A48 for ; Wed, 28 Sep 2005 09:53:45 -0300 (ADT) Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j8SCrZlO019580; Wed, 28 Sep 2005 22:53:35 +1000 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id j8SCrZl4019577; Wed, 28 Sep 2005 22:53:35 +1000 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Wed, 28 Sep 2005 22:53:35 +1000 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: Slow concurrent update of same row in a given table In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 required=5 tests=[AWL=0.001] X-Spam-Level: X-Archive-Number: 200509/389 X-Sequence-Number: 14697 On Wed, 28 Sep 2005, Rajesh Kumar Mallah wrote: > Hi > > While doing some stress testing for updates in a small sized table > we found the following results. We are not too happy about the speed > of the updates particularly at high concurrency (10 clients). > > Initially we get 119 updates / sec but it drops to 10 updates/sec > as concurrency is increased. > > PostgreSQL: 8.0.3 > ------------------------------- > TABLE STRUCTURE: general.stress > ------------------------------- > | dispatch_id | integer | not null | > | query_id | integer | | > | generated | timestamp with time zone | | > | unsubscribes | integer | | > | read_count | integer | | > | status | character varying(10) | | > | bounce_tracking | boolean | | > | dispatch_hour | integer | | > | dispatch_date_id | integer | | > +------------------+--------------------------+-----------+ > Indexes: > "stress_pkey" PRIMARY KEY, btree (dispatch_id) > > UPDATE STATEMENT: > update general.stress set read_count=read_count+1 where dispatch_id=114 This means you are updating only one row, correct? > Number of Copies | Update perl Sec > > 1 --> 119 > 2 ---> 59 > 3 ---> 38 > 4 ---> 28 > 5 --> 22 > 6 --> 19 > 7 --> 16 > 8 --> 14 > 9 --> 11 > 10 --> 11 > 11 --> 10 So, 11 instances result in 10 updated rows per second, database wide or per instance? If it is per instance, then 11 * 10 is close to the performance for one connection. That being said, when you've got 10 connections fighting over one row, I wouldn't be surprised if you had bad performance. Also, at 119 updates a second, you're more than doubling the table's initial size (dead tuples) each second. How often are you vacuuming and are you using vacuum or vacuum full? Gavin