Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 587F59FA13B for ; Wed, 11 Jul 2007 13:11:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 20336-05 for ; Wed, 11 Jul 2007 13:10:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 411179FA06B for ; Wed, 11 Jul 2007 13:11:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l6BGAtjI026708; Wed, 11 Jul 2007 12:10:55 -0400 (EDT) To: Andrew Sullivan cc: pgsql-performance@postgresql.org Subject: Re: TIMING A QUERY ??? In-reply-to: <20070711153911.GQ1241@phlogiston.dyndns.org> References: <11542393.post@talk.nabble.com> <20070711153911.GQ1241@phlogiston.dyndns.org> Comments: In-reply-to Andrew Sullivan message dated "Wed, 11 Jul 2007 11:39:11 -0400" Date: Wed, 11 Jul 2007 12:10:55 -0400 Message-ID: <26707.1184170255@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/98 X-Sequence-Number: 25782 Andrew Sullivan writes: > On Wed, Jul 11, 2007 at 08:21:40AM -0700, smiley2211 wrote: >> How can I get the time it takes a query to execute - explain analyze is >> taking over 5 hours to complete > You can't get it any faster than what explain analyse does: it runs > the query. How else would you get the answer? Well, on some platforms (ie consumer-grade PCs) explain analyze can be a lot slower than just running the query, because of the overhead of all those gettimeofday() calls it does. El cheapo clock hardware is slow to read. (I think the problem is actually that the PC-standard hardware API for clocks was designed back when taking a whole microsecond to read the clock didn't seem like a problem.) >> ...can I use \timing??? I don't get any time when using the >> \timing option... > How so? It returns Time: N ms at the end of output for me. Works for me too. regards, tom lane