X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A2E889DCD36 for ; Tue, 6 Dec 2005 05:52:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75866-06 for ; Tue, 6 Dec 2005 05:52:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by postgresql.org (Postfix) with ESMTP id 6F7429DCCC3 for ; Tue, 6 Dec 2005 05:51:59 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so926450nzp for ; Tue, 06 Dec 2005 01:52:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gzyohNjSZKHMCCPIYPXiv1Z4m9N7M16uhfRlcQU1B4Yf5i66JcuHuV28w7DI5VRbCnddmnTLjxRyJ13jsrC0AqnQIwTAAaXxdaSy0A9vYssB3ZI4g44utWS3lnuMR4k1hcZWGr6AQpSIpq5hI/3YBIkTC8zg8D7GI+eWsErVji0= Received: by 10.64.253.8 with SMTP id a8mr295673qbi; Tue, 06 Dec 2005 01:52:01 -0800 (PST) Received: by 10.64.209.2 with HTTP; Tue, 6 Dec 2005 01:52:01 -0800 (PST) Message-ID: <5e744e3d0512060152s14eeb0abg99b3c0c6df5174b5@mail.gmail.com> Date: Tue, 6 Dec 2005 15:22:01 +0530 From: Pandurangan R S To: Assaf Yaari Subject: Re: Performance degradation after successive UPDATE's Cc: pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.139 required=5 tests=[AWL=0.139] X-Spam-Score: 0.139 X-Spam-Level: X-Archive-Number: 200512/150 X-Sequence-Number: 15971 Hi, You might try these steps 1. Do a vacuum full analyze 2. Reindex the index on id column 3. Cluster the table based on this index On 12/5/05, Assaf Yaari wrote: > > Hi, > > I'm using PostgreSQL 8.0.3 on Linux RedHat WS 3.0. > > My application updates counters in DB. I left a test over the night that > increased counter of specific record. After night running (several hundre= ds > of thousands updates), I found out that the time spent on UPDATE increase= d > to be more than 1.5 second (at the beginning it was less than 10ms)! Issu= ing > VACUUM ANALYZE and even reboot didn't seemed to solve the problem. > > I succeeded to re-produce this with a simple test: > > I created a very simple table that looks like that: > CREATE TABLE test1 > ( > id int8 NOT NULL, > counter int8 NOT NULL DEFAULT 0, > CONSTRAINT "Test1_pkey" PRIMARY KEY (id) > ) ; > > I've inserted 15 entries and wrote a script that increase the counter of > specific record over and over. The SQL command looks like this: > UPDATE test1 SET counter=3Dnumber WHERE id=3D10; > > At the beginning the UPDATE time was around 15ms. After ~90000 updates, t= he > execution time increased to be more than 120ms. > > 1. What is the reason for this phenomena? > 2. Is there anything that can be done in order to improve this? > > Thanks, > Assaf -- Regards Pandu