Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNmKp-00029g-LW for pgsql-performance@arkaria.postgresql.org; Thu, 04 Apr 2013 15:44:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UNmKp-0003Jm-2K for pgsql-performance@arkaria.postgresql.org; Thu, 04 Apr 2013 15:44:19 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNmKn-0003IQ-54 for pgsql-performance@postgresql.org; Thu, 04 Apr 2013 15:44:17 +0000 Received: from smtp12.smtpout.orange.fr ([80.12.242.134] helo=smtp.smtpout.orange.fr) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNmKf-0001e2-Vf for pgsql-performance@postgresql.org; Thu, 04 Apr 2013 15:44:16 +0000 Received: from axege.com ([82.127.232.162]) by mwinf5d35 with ME id Krk71l00C3WtTCJ03rk7n9; Thu, 04 Apr 2013 17:44:07 +0200 Received: from localhost (localhost [127.0.0.1]) by axege.com (Postfix) with ESMTP id E3BBE43DE04; Thu, 4 Apr 2013 17:44:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at myhostname="axege.com." Received: from axege.com ([127.0.0.1]) by localhost (axege.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x4mLZTWw8DSw; Thu, 4 Apr 2013 17:44:05 +0200 (CEST) Received: from [10.0.0.84] (unknown [10.0.0.84]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by axege.com (Postfix) with ESMTPSA id A776E43DE02; Thu, 4 Apr 2013 17:44:05 +0200 (CEST) Message-ID: <515D9FC5.7030105@axege.com> Date: Thu, 04 Apr 2013 17:44:05 +0200 From: Franck Routier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Nikolas Everett CC: postgres performance list Subject: Re: What happens between end of explain analyze and end of query execution ? References: <515D92BF.5000309@axege.com> In-Reply-To: Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms020903030307010309020208" X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Ceci est un message signé cryptographiquement au format MIME. --------------ms020903030307010309020208 Content-Type: multipart/alternative; boundary="------------070803090408090807090001" This is a multi-part message in MIME format. --------------070803090408090807090001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Right, explain alone takes 3.6 seconds, so the time really seems to go=20 query planning... Le 04/04/2013 17:01, Nikolas Everett a =E9crit : > We had a problem where the actual query planning time blew up and took = > way more time then the query execution. We reproduced the problem by=20 > forming a new connection and then just explaining the query. If that=20 > takes more than a couple of milliseconds you likely have the problem.=20 > The second plan was fast. > > We then dtraced the backend process for a new connection and found=20 > that opening files had become super slow. In our case this was caused = > by running the database on nfs. > > Good luck, > > Nik > > > On Thu, Apr 4, 2013 at 10:48 AM, Franck Routier=20 > > wrote: > > Hi, > > I have query that should be quick, and used to be quick, but is > not anymore... Explain analyze can be seen here > http://explain.depesz.com/s/cpV > but it is fundamentaly quick : Total runtime: 0.545 ms. > > But query execution takes 3.6 seconds. Only 12 rows are returned. > Adding a limit 1 has no influence. > > Postgresql client and server are on the same server, on localhost. > > I wonder where my 3.5 seconds are going.... > > Notice that there is no fancy configuration to tell Postgresql to > evaluate every query plan on earth, that is gecoxxxx settings are > on their default values. > > Any idea on what can be happening that takes so long ? > > Franck > > --------------070803090408090807090001 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Right, explain alone takes 3.6 seconds= , so the time really seems to go query planning...


Le 04/04/2013 17:01, Nikolas Everett a écrit :
We had a problem where the actual query planning time blew up and took way more time then the query execution.  We reproduced the problem by forming a new connection and t= hen just explaining the query.  If that takes more than a couple= of milliseconds you likely have the problem.  The second plan w= as fast.

We then dtraced the backend process for a new connection and found that opening files had become super slow.  In our case this was caused by running the database on nf= s.

Good luck,

Nik


On Thu, Apr 4, 2013 at 10:48 AM, Franc= k Routier <= franck.routier@axege.com> wrote:
Hi,

I have query that should be quick, and used to be quick, but is not anymore... Explain analyze can be seen here = http://explain.depesz.com/s/cpV
but it is fundamentaly quick : Total runtime: 0.545 ms.

But query execution takes 3.6 seconds. Only 12 rows are returned. Adding a limit 1 has no influence.

Postgresql client and server are on the same server, on localhost.

I wonder where my 3.5 seconds are going....

Notice that there is no fancy configuration to tell Postgresql to evaluate every query plan on earth, that is gecoxxxx settings are on their default values.

Any idea on what can be happening that takes so long ?

Franck



--------------070803090408090807090001-- --------------ms020903030307010309020208 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: Signature cryptographique S/MIME MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIINYjCC BjQwggQcoAMCAQICAR4wDQYJKoZIhvcNAQEFBQAwfTELMAkGA1UEBhMCSUwxFjAUBgNVBAoT DVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3VyZSBEaWdpdGFsIENlcnRpZmljYXRlIFNp Z25pbmcxKTAnBgNVBAMTIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA3 MTAyNDIxMDE1NVoXDTE3MTAyNDIxMDE1NVowgYwxCzAJBgNVBAYTAklMMRYwFAYDVQQKEw1T dGFydENvbSBMdGQuMSswKQYDVQQLEyJTZWN1cmUgRGlnaXRhbCBDZXJ0aWZpY2F0ZSBTaWdu aW5nMTgwNgYDVQQDEy9TdGFydENvbSBDbGFzcyAxIFByaW1hcnkgSW50ZXJtZWRpYXRlIENs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