Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C4F8E1337CFB for ; Thu, 7 Oct 2010 14:12:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 69252-01-10 for ; Thu, 7 Oct 2010 17:12:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 33FAA1337D3B for ; Thu, 7 Oct 2010 14:10:00 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 07 Oct 2010 12:09:59 -0500 Message-Id: <4CADB891020000250003663F@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 07 Oct 2010 12:09:53 -0500 From: "Kevin Grittner" To: , Subject: Re: query execution time References: <4CADB8670200002500036637@gw.wicourts.gov> <4CADB891020000250003663F@gw.wicourts.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/76 X-Sequence-Number: 35817 Julius Tuskenis wrote: > we connect to localhost on windows machine because we > use ssh tunel to the postgresql server on gentoo linux. Latency in the extra hop or from encryption/decryption of the streams could account for at least some of the difference between how long it took the server to run the query versus the elapsed time between when the client started sending it out and when it got the last of the response. > The DB is used for web application writen in PHP. As the DB and > WEB servers are on the same machine we can rule out the network > issues I guess... What you can't rule out is the possibility that the web app thread reading the response doesn't get a time slice for some time after the database is done. > The behavior described is observed when there is high server > usage. Using "server status" tool shows several such queries > executed suddenly and then after some waiting everything goes back > to normal. Can you run `vmstat 1` and see what it shows during an episode? This could be particularly valuable if you can timestamp the lines to compare to log entries. You might want to turn on checkpoint logging. Again, we don't know anything about the amount of RAM, your postgresql.conf settings, your disk subsystem (particularly your RAID adapter and its configuration), etc. With more information we can give better advice. -Kevin