Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id F33C79FBC30 for ; Tue, 7 Aug 2007 11:53:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 24482-09 for ; Tue, 7 Aug 2007 11:53:24 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.186]) by postgresql.org (Postfix) with ESMTP id 9F9D59FB2BD for ; Tue, 7 Aug 2007 11:53:33 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id f1so1187287rvb for ; Tue, 07 Aug 2007 07:53:31 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g8RLNJeluy8b2vOfUdDbCDnigIctj6rB+k2TUql7M2EoiSx95WYMDpgoy84C7F19XrfGihDZzTYiVNVzq88Ke//aRRRXVluoQgeMAiLzX7Y67PQ5FF5QUqa5PpmsW7zSv9sj7TZij2Q4kMWSS3HXOtqAkw0cnHx3EQrIgZGA0bM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Fx9Rs0oF11/L5Yv/tKdnemFiBIkVRXx/wOwtvYc5xuFxDPjtXmfAIhmcT0xGNnXNKFqrzB75FapYUFRPnlpVN+WwYWKgGGOms9ptXXa1VPi+fajSF8I9FkvyW7+e3jlrluIEwTN4bSY14v6jkJpAzFjihhumoS6QQP8QosKXCMo= Received: by 10.141.51.15 with SMTP id d15mr2550435rvk.1186498411608; Tue, 07 Aug 2007 07:53:31 -0700 (PDT) Received: by 10.141.162.12 with HTTP; Tue, 7 Aug 2007 07:53:31 -0700 (PDT) Message-ID: Date: Tue, 7 Aug 2007 09:53:31 -0500 From: "Scott Marlowe" To: "Mark Makarowsky" Subject: Re: Update table performance Cc: pgsql-performance@postgresql.org In-Reply-To: <435532.80672.qm@web32210.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <435532.80672.qm@web32210.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/58 X-Sequence-Number: 26188 On 8/7/07, Mark Makarowsky wrote: > I have a table with 4,889,820 records in it. The > table also has 47 fields. I'm having problems with > update performance. Just as a test, I issued the > following update: > > update valley set test='this is a test' > > This took 905641 ms. Isn't that kind of slow? There > aren't any indexes, triggers, constraints or anything > on this table. The version of Postgres is "PostgreSQL > 8.2.4 on i686-pc-mingw32, compiled by GCC gcc.exe > (GCC) 3.4.2 (mingw-special)". The operating > environment is Windows 2003 Standard Edition w/service > pack 2. It is 2.20 Ghz with 1.0 GB of RAM. Here is > the results from Explain: > > "Seq Scan on valley (cost=0.00..1034083.57 > rows=4897257 width=601)" Have you done this a few times? You could easily have a very large and bloated table if you do this several times in a row. That would explain the slow performance. If you're going to do a lot of updates without where clauses on large tables, you'll need to run a vacuum right afterwards to clean things up. I see that you included a lot about your machine, but you didn't include any specs on your disk subsystem. When it comes to update speed, the disk subsystem is probably the most important part. Note also that Windows is still not the preferred platform for postgresql from a performance perspective (actually, the only database where that's true is MS-SQL really). Have you run any benchmarks on your disk subsystem to see how fast it is?