X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A85D88BA0E5 for ; Thu, 10 Feb 2005 20:25:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96303-10 for ; Thu, 10 Feb 2005 20:25:09 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id A16DA8B9FD6 for ; Thu, 10 Feb 2005 20:25:09 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 682D914BC49; Thu, 10 Feb 2005 15:25:09 -0500 (EST) From: Chris Kratz Organization: VistaShare To: Darcy Buskermolen Subject: Re: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 15:25:09 -0500 User-Agent: KMail/1.7.1 Cc: Tom Lane , pgsql-performance@postgresql.org References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> <200502101209.42079.darcy@wavefire.com> In-Reply-To: <200502101209.42079.darcy@wavefire.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502101525.09165.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/176 X-Sequence-Number: 10505 On Thursday 10 February 2005 03:09 pm, Darcy Buskermolen wrote: > On February 10, 2005 10:58 am, Tom Lane wrote: > > Chris Kratz writes: > > > Does anyone have any idea why there be over a 4s difference between > > > running the statement directly and using explain analyze? > > > > > > Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual > > > time=4841.231..4841.235 rows=1 loops=1) > > > -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) > > > (actual time=0.011..2347.762 rows=530576 loops=1) > > > Total runtime: 4841.412 ms > > > > EXPLAIN ANALYZE's principal overhead is two gettimeofday() kernel calls > > per plan node execution, so 1061154 such calls here. I infer that > > gettimeofday takes about 4 microseconds on your hardware ... which seems > > a bit slow for modern machines. What sort of box is it? > > dvl reported the same thing on #postgresql some months back, and neilc > was/is/did looking into it. I belive he came up with a way to move the > function call outside of the loop with no ill effects to the rest of the > expected behavior. That's interesting to know. It's not a big deal, we were just curious as to why the difference. Tom's explanation makes good sense. We run into the same situation with using a profiler on an application, ie measuring incurs overhead. -Chris