Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2F6366325DE for ; Fri, 8 Jan 2010 14:12:17 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60190-09 for ; Fri, 8 Jan 2010 18:12:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id E364D6337DC for ; Fri, 8 Jan 2010 14:12:04 -0400 (AST) Received: from [192.168.1.3] (pool-96-244-14-10.bltmmd.fios.verizon.net [96.244.14.10]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LqFBg-1O71qT3W4m-00eLyE; Fri, 08 Jan 2010 19:12:03 +0100 Message-ID: <4B477570.4080804@2ndquadrant.com> Date: Fri, 08 Jan 2010 13:12:00 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Carlo Stonebanks CC: pgsql-performance@postgresql.org Subject: Re: Massive table (500M rows) update nightmare References: <4B462563020000250002DFA3@gw.wicourts.gov> <4B46E8A7020000250002E012@gw.wicourts.gov> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+koi6emN1OW5vpxtvufRZpVRP8ralwgyvt5cc U1TP+vIuGvhddA5mfwQDhZc7qM0VGNT0BvOatv6xp22lMZXcNv Rbmhr3V3uh3I06XEtf04mj6KUGxk5ae X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/150 X-Sequence-Number: 37030 Carlo Stonebanks wrote: > This is hosted on a new server the client set up so I am waiting for > the exact OS and hardware config. PG Version is PostgreSQL 8.3.6, > compiled by Visual C++ build 1400, OS appears to be Windows 2003 x64 > Server. > > More than anything, I am more concerned with the long-term use of the > system. This particular challenge with the 500M row update is one > thing, but I am concerned about the exceptional effort required to do > this. Is it REALLY this exceptional to want to update 500M rows of > data in this day and age? Or is the fact that we are considering > dumping and restoring and dropping indexes, etc to do all an early > warning that we don't have a solution that is scaled to the problem? It's certainly not common or easy to handle. If someone told me I had to make that task well perform well and the tools at hand were anything other than a largish UNIX-ish server with a properly designed disk subsystem, I'd tell them it's unlikely to work well. An UPDATE is the most intensive single operation you can do in PostgreSQL; the full lifecycle of executing it requires: -Creating a whole new row -Updating all the indexes to point to the new row -Marking the original row dead -Pruning the original row out of the database once it's no longer visible anywhere (VACUUM) As a rule, if you can't fit a large chunk of the indexes involved in shared_buffers on your system, this is probably going to have terrible performance. And you're on a platform where that's very hard to do, even if there's a lot of RAM around. It sounds like your system spends all its time swapping index blocks in and out of the database buffer cache here. That suggests there's a design problem here either with those indexes (they're too big) or with the provisioned hardware/software combination (needs more RAM, faster disks, or a platform where large amounts of RAM work better). -- Greg Smith 2ndQuadrant Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.com