Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id D5C6F7412C2 for ; Sat, 10 Dec 2011 19:51:08 -0400 (AST) Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RZWh9-0003eD-MY for pgsql-performance@postgresql.org; Sat, 10 Dec 2011 23:51:08 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 691EC4A20A2 for ; Sun, 11 Dec 2011 00:50:54 +0100 (CET) Received: from mail.gransy.com ([82.208.29.194]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id qlFRr6WxDlKb for ; Sun, 11 Dec 2011 00:50:54 +0100 (CET) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id 43BCF4A2007 for ; Sun, 11 Dec 2011 00:50:54 +0100 (CET) Message-ID: <4EE3F060.6000602@fuzzy.cz> Date: Sun, 11 Dec 2011 00:50:56 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Common slow query reasons - help with a special log References: <4EE39620.5020703@fuzzy.cz> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201112/84 X-Sequence-Number: 45883 On 10.12.2011 23:40, Daniel Cristian Cruz wrote: > At work we have a 24 cores server, with a load average around 2.5. A single query is processes by a single CPU, so even if the system is not busy a single query may hit CPU bottleneck. The real issue is the instrumentation overhead - timing etc. On some systems (with slow gettimeofday) this may be a significant problem as the query hits the CPU boundary sooner. > I don't know yet if a system which use some unused CPU to minimize the > load of a bad query identified early is bad or worse. Not really, due to the "single query / single CPU" rule. > Indeed, I don't know if my boss would let me test this at production > too, but it could be good to know how things work in "auto-pilot" mode. What I was pointing out is that you probably should not enable loggin "explain analyze" output by "auto_explain.log_analyze =3D true". There ar= e three levels of detail: 1) basic, just log_min_duration_statement 2) auto_explain, without 'analyze' - just explain plain 3) auto_explain, with 'analyze' - explain plan with actual values Levels (1) and (2) are quite safe (unless the minimum execution time is too low). Tomas >=20 > 2011/12/10 Tomas Vondra > >=20 > There's auto_explain contrib module that does exactly what you're a= sking > for. Anyway, explain analyze is quite expensive - think twice befor= e > enabling that on production server where you already have performan= ce > issues. >=20 > Tomas >=20 > On 10.12.2011 17:52, Daniel Cristian Cruz wrote: > > Hi all, > > > > I'm trying to figure out some common slow queries running on the > server, > > by analyzing the slow queries log. > > > > I found debug_print_parse, debug_print_rewritten, debug_print_pla= n, > > which are too much verbose and logs all queries. > > > > I was thinking in something like a simple explain analyze just fo= r > > queries logged with log_min_duration_statement with the query too= . > > > > Is there a way to configure PostgreSQL to get this kind of > information, > > maybe I'm missing something? Is it too hard to hack into sources > and do > > it by hand? I never touched PostgreSQL sources. > > > > I'm thinking to write a paper that needs this information for my > > postgraduate course. The focus of my work will be the log data, n= ot > > PostgreSQL itself. If I succeed, maybe it can be a tool to help > all of us. > > > > Thank you, > > -- > > Daniel Cristian Cruz > > =E3=82=AF=E3=83=AB=E3=82=BA =E3=82=AF=E3=83=AA=E3=82=B9=E3=83=81=E3= =82=A2=E3=83=B3 =E3=83=80=E3=83=8B=E3=82=A8=E3=83=AB >=20 >=20 > -- > Sent via pgsql-performance mailing list > (pgsql-performance@postgresql.org > ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance >=20 >=20 >=20 >=20 > --=20 > Daniel Cristian Cruz > =E3=82=AF=E3=83=AB=E3=82=BA =E3=82=AF=E3=83=AA=E3=82=B9=E3=83=81=E3=82=A2= =E3=83=B3 =E3=83=80=E3=83=8B=E3=82=A8=E3=83=AB