Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id C16B39FB71C for ; Tue, 7 Aug 2007 16:36:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 60981-03-3 for ; Tue, 7 Aug 2007 16:36:18 -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.188]) by postgresql.org (Postfix) with ESMTP id 1EB729FA306 for ; Tue, 7 Aug 2007 16:36:19 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id f1so1235709rvb for ; Tue, 07 Aug 2007 12:36:18 -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=FhgaezthZosXaaMdc/pEOGpVMR0OngxMMsdhK475hwmBn/Lr0/Khdnk+jQIqpvBQUgbwDLC+uSnzskZ86J5QOaVGd0yy4dvoOqi1mSO+fETUwyPiT+2mSkEiGM+iNPZfgKCCgZau3ZMcWRNqZkOtyxCblmZr38nGt549pfLg0IE= 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=MS1leRy2cEPn33NFqvPjRqDbj1WyqPMnJqOgIZETOiSSaVpkTEw2Wx6Wr/vtqJqdz6eoabKjvJikzgVmkRM4JXnNh8GL44z/B6hQ+aqye3AzSdD5YA9xvX+OUdC01H1AneqvvY0Fx5E/MNWwfb1LgHvkxj2Sue94pW8N5Ax57cI= Received: by 10.141.51.15 with SMTP id d15mr2667952rvk.1186515378583; Tue, 07 Aug 2007 12:36:18 -0700 (PDT) Received: by 10.141.162.12 with HTTP; Tue, 7 Aug 2007 12:36:18 -0700 (PDT) Message-ID: Date: Tue, 7 Aug 2007 14:36:18 -0500 From: "Scott Marlowe" To: Decibel! Subject: Re: Update table performance Cc: "Richard Huxton" , "Mark Makarowsky" , pgsql-performance@postgresql.org In-Reply-To: <20070807175913.GH25704@nasby.net> 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> <46B8749F.8010002@archonet.com> <20070807175913.GH25704@nasby.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/62 X-Sequence-Number: 26192 On 8/7/07, Decibel! wrote: > On Tue, Aug 07, 2007 at 02:33:19PM +0100, Richard Huxton wrote: > > 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? > > > > The limiting factor here will be how fast you can write to your disk. > > Well, very possibly how fast you can read, too. Using your assumption of > 1k per row, 5M rows means 5G of data, which might well not fit in > memory. And if the entire table's been updated just once before, even > with vacuuming you're now at 10G of data. Where one might have to update just one column of a wide table often, it's often a good idea to move that column into its own dependent table. Or just don't update one column of every row in table...