Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0E8959FB48C for ; Thu, 12 Jul 2007 11:27:14 -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 90455-08 for ; Thu, 12 Jul 2007 11:27:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 3F93C9FB1CD for ; Thu, 12 Jul 2007 11:27:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l6CER4lq017712; Thu, 12 Jul 2007 10:27:04 -0400 (EDT) To: Craig James cc: pgsql-performance@postgresql.org Subject: Re: pg_restore causes 100 In-reply-to: <4695D995.9040207@emolecules.com> References: <46898AB3.7090409@emolecules.com> <87hcom5p41.fsf@oxford.xeocode.com> <469429FD.6080504@emolecules.com> <13642.1184117103@sss.pgh.pa.us> <4695D995.9040207@emolecules.com> Comments: In-reply-to Craig James message dated "Thu, 12 Jul 2007 00:34:45 -0700" Date: Thu, 12 Jul 2007 10:27:03 -0400 Message-ID: <17711.1184250423@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/142 X-Sequence-Number: 25826 Craig James writes: > Now here's the weird thing. I'm running a pg_restore of a database > (on the order of 4GB compressed, maybe 34M rows of ordinary data, and > 15M rows in one BLOB table that's typically 2K per blob). When I do > this, ALL of the postgress backends start working at about 1% CPU > apiece. It's not surprising that they'd all start eating some CPU, if that's a schema restore and not just bulk data loading. Any catalog change is going to broadcast "shared cache inval" messages that all the backends have to process to make sure they get rid of any now-obsolete cached catalog information. > This means that the 120 "idle" postgres backends are together > using almost 100% of one CPU on top of the 100% CPU being used by > pg_restore. See the output of top(1) below. Perhaps you need to try to cut down the number of idle processes ... I don't think anyone's ever spent any time trying to micro-optimize the shared cache inval code paths. It could be we could cut your 1% figure some, if we were willing to put effort into that. But it's not going to go to zero. regards, tom lane