Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYzfI-00069l-Ki for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Oct 2013 14:44:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VYzfI-0002Bs-4v for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Oct 2013 14:44:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYzfH-0002Bm-DK for pgsql-bugs@postgresql.org; Wed, 23 Oct 2013 14:44:03 +0000 Received: from mail.gransy.com ([2001:1528:137::f1]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYzfD-0002TO-NY for pgsql-bugs@postgresql.org; Wed, 23 Oct 2013 14:44:02 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 97A0F508C7F; Wed, 23 Oct 2013 16:43:57 +0200 (CEST) X-Virus-Scanned: G-Hosting.cz + Station.cz + Klenot.cz + Subreg.cz amavisd-new at antispam.gransy.com Received: from mail.gransy.com ([82.208.44.189]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id y-dyqHl5vkvH; Wed, 23 Oct 2013 16:44:06 +0200 (CEST) Received: by mail.gransy.com (Postfix, from userid 5000) id 4A896508C82; Wed, 23 Oct 2013 16:43:57 +0200 (CEST) Received: from sq.gransy.com (elizabeth.gransy.com [89.187.132.199]) by mail.gransy.com (Postfix) with ESMTPA id 967AA508C7F; Wed, 23 Oct 2013 16:43:56 +0200 (CEST) Received: from 78.45.139.138 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Wed, 23 Oct 2013 16:44:01 +0200 Message-ID: <4b1a3cc650d1ab10de13360bf2222dc2.squirrel@sq.gransy.com> In-Reply-To: References: Date: Wed, 23 Oct 2013 16:44:01 +0200 Subject: Re: crazy logging from PG 8.4 From: "Tomas Vondra" To: "Jon Nelson" Cc: pgsql-bugs@postgresql.org User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Pg-Spam-Score: -0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 23 Říjen 2013, 16:00, Jon Nelson wrote: > After several days of running a simple query over a very large dataset > (more than a terabyte), I logged in to note that postgresql had > decided to log *billions* of log lines. > > The query looks like this: > > create table result_table as > select TEXTFIELD, count(distinct INTFIELD) from SOME_HUGE_TABLE group > by TEXTFIELD; > > At some point, PG started logging stuff that looked like this (over > and over again): > > SELECT 2704204951 user@dbname LOG: 00000: performsort starting: CPU > 0.00.... > > The 2704204951 number corresponds to the "%l" (session line number) > in log_line_prefix. Thus, by the time I saw this, it had logged 2.7 > billion lines. > > > An strace of the process showed this, over and over again: > > getrusage(....) > write(2, ) > > and nothing else. What happened here? It seems like PG just went > crazy and got itself into some sort of loop. I had to kill the query. First guess is that you enabled detailed logging in config. See log_*_stats in http://www.postgresql.org/docs/8.4/static/runtime-config-statistics.html I'd guess it's log_executor_stats, but as you've copied a single line (and not even that one was complete), it's hard to say. Those are the only lines referring to getrusage in the source code, although I'm not sure any of those could that produce the number of messages you've mentioned. > This is PostgreSQL 8.4.13 on x86_64, Linux, using Scientific Linux 6.4. Not really the most updated 8.4 install. Please consider updating to 8.4.18. Tomas -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs