Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 3773C19F3CE for ; Mon, 11 Jun 2012 11:02:41 -0300 (ADT) Received: from mail-ee0-f46.google.com ([74.125.83.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Se5Ca-0003ZT-EA for pgsql-performance@postgresql.org; Mon, 11 Jun 2012 14:02:41 +0000 Received: by eeit10 with SMTP id t10so1856292eei.19 for ; Mon, 11 Jun 2012 07:02:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=16fP9r6auT4urW5b3zUF2LK9XVmHh1QErSs83NXfZqQ=; b=jxKGS5MqCspQP9QavoBPTIx2BJjp2WqR4MGr0oN2dd32lECzCPrlfYoC1Vv3aXKxyn 4GBanriVIUOxE+NQW8iSp4dA/KTuUVe6V4qrzFjvZyU6aK5skjAh8ffxRRd7trV81rrH AF7Gmr8Ocm4gyeGfOLoBGnPUN411kqzDmOyMIhJm9sxy+25011TE0gQRx8hwQlPiqE71 A7/xUYHlb3Ns/0rsH0dKBJe2ZHB7D4BeQIo0ge+ij4gW1ZSg0/LUYUjcC2SespJ5jm95 IIWrHJS4RRBR+bE36pRhkNZZzHVQBXGS5+xTVnHaWbxV1DO7ad1BmkEawkgGDSvWJUft A5Sg== Received: by 10.14.127.72 with SMTP id c48mr6323227eei.81.1339423346495; Mon, 11 Jun 2012 07:02:26 -0700 (PDT) Received: from [192.168.41.201] (host81-142-153-89.in-addr.btopenworld.com. [81.142.153.89]) by mx.google.com with ESMTPS id p41sm53073430eef.5.2012.06.11.07.02.24 (version=SSLv3 cipher=OTHER); Mon, 11 Jun 2012 07:02:25 -0700 (PDT) Message-ID: <4FD5FA6F.3080903@optrak.com> Date: Mon, 11 Jun 2012 15:02:23 +0100 From: Mark Thornton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: sthomas@optionshouse.com, pgsql-performance@postgresql.org Subject: Re: Performance of CLUSTER References: <4FD458CA.3070902@optrak.com> <4FD5F5DC.3080507@optionshouse.com> <4FD5F6B5.2090505@optrak.com> <4FD5F837.5080006@optionshouse.com> In-Reply-To: <4FD5F837.5080006@optionshouse.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnZd7m0ma4UW0iuW5ChMEsrVsjkYBdKs2qeDmZkvQzf+a5fSrElZjhwdz0uhG+UcVNmjB7e X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201206/63 X-Sequence-Number: 47089 On 11/06/12 14:52, Shaun Thomas wrote: > On 06/11/2012 08:46 AM, Mark Thornton wrote: > >> 500m --- though isn't clear if cluster uses maintenance memory or the >> regular work memory. I could readily use a higher value for >> maintenance_work_mem. > > For an operation like that, having a full GB wouldn't hurt. Though if > you haven't already, you might think about pointing I didn't think the process was using even the 500m it ought to have had available, whereas creating an index did appear to use that much. Note though that I didn't stay up all night watching it! > your pgsql_tmp to /dev/shm for a while, even for just this operation. > > Then again, is your CPU at 100% during the entire operation? No the CPU utilization is quite low. Most of the time is waiting for IO. > If it's not fetching anything from disk or writing out much, reducing > IO won't help. :) One deficiency we've had with CLUSTER is that it's a > synchronous operation. It does each thing one after the other. So > it'll organize the table contents, then it'll reindex each index > (including the primary key) one after the other. If you have a lot of > those, that can take a while, especially if any composite or complex > indexes exist. In this case there are only two indexes, the gist one and a primary key (on a bigint value). > > You might actually be better off running parallel REINDEX commands on > the table (I wrote a script for this because we have a 250M row table > that each index takes 1-2.5 hours to build). You might also consider > pg_reorg, which seems to handle some parts of a table rebuild a little > better. > > That should give you an escalation pattern, though. :) Thanks for your help, Mark Thornton