Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 05454650858 for ; Wed, 9 Jul 2008 09:58:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 35156-06 for ; Wed, 9 Jul 2008 09:58:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from panix.internal.net (cpe-77-83-163-186-dsl.netone.gr [77.83.163.186]) by postgresql.org (Postfix) with ESMTP id 9BD9E650869 for ; Wed, 9 Jul 2008 09:58:49 -0300 (ADT) Received: from panix.internal.net (localhost [127.0.0.1]) by panix.internal.net (8.14.2/8.14.2) with ESMTP id m69CV6wf068885; Wed, 9 Jul 2008 15:31:06 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by panix.internal.net (8.14.2/8.14.2/Submit) id m69CV5Hk068884; Wed, 9 Jul 2008 15:31:05 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) X-Authentication-Warning: panix.internal.net: achix set sender to achill@matrix.gatewaynet.com using -f From: "achill@matrix" To: Tom Lane Subject: Re: syslog performance when logging big statements Date: Wed, 9 Jul 2008 15:31:05 +0300 User-Agent: KMail/1.9.7 Cc: pgsql-performance@postgresql.org References: <200807081524.47366.achill@matrix.gatewaynet.com> <200807081821.57935.achill@matrix.gatewaynet.com> <12596.1215542041@sss.pgh.pa.us> In-Reply-To: <12596.1215542041@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200807091531.05372.achill@matrix.gatewaynet.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=RDNS_DYNAMIC=0.1 X-Spam-Level: X-Archive-Number: 200807/83 X-Sequence-Number: 30683 =CE=A3=CF=84=CE=B9=CF=82 Tuesday 08 July 2008 21:34:01 =CE=BF/=CE=B7 Tom La= ne =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > Achilleas Mantzios writes: > > =CE=A3=CF=84=CE=B9=CF=82 Tuesday 08 July 2008 17:35:16 =CE=BF/=CE=B7 To= m Lane =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > >> Hmm. There's a function in elog.c that breaks log messages into chunks > >> for syslog. I don't think anyone's ever looked hard at its performance > >> --- maybe there's an O(N^2) behavior? > > > > Thanx, > > i changed PG_SYSLOG_LIMIT in elog.c:1269 from 128 to 1048576 > > and i got super fast stderr performance. :) > > Doesn't seem like a very good solution given its impact on the stack > depth right there. > > Looking at the code, the only bit that looks like repeated work are the > repeated calls to strchr(), which would not be an issue in the "typical" > case where the very long message contains reasonably frequent newlines. > Am I right in guessing that your problematic statement contained > megabytes worth of text with nary a newline? Yes it was the input source of a bytea field containing tiff or pdf data, of size of some 1-3 megabytes, and it did not contain (many) newlines. > > If so, we can certainly fix it by arranging to remember the last > strchr() result across loop iterations, but I'd like to confirm the > theory before doing that work. > > regards, tom lane