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 5320C8B9FB0 for ; Thu, 10 Feb 2005 20:10:16 +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 95049-10 for ; Thu, 10 Feb 2005 20:09:45 +0000 (GMT) Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) by svr1.postgresql.org (Postfix) with SMTP id 18AFB8BA027 for ; Thu, 10 Feb 2005 20:09:45 +0000 (GMT) Received: (qmail 24504 invoked from network); 10 Feb 2005 21:31:37 -0000 Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) (darcy@64.141.15.253) by radius.wavefire.com with SMTP; 10 Feb 2005 21:31:37 -0000 From: Darcy Buskermolen Organization: Wavefire Technologies Corp. To: Tom Lane Subject: Re: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 12:09:42 -0800 User-Agent: KMail/1.6.2 Cc: Chris Kratz , pgsql-performance@postgresql.org References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> In-Reply-To: <28553.1108061917@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502101209.42079.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/175 X-Sequence-Number: 10504 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. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Darcy Buskermolen Wavefire Technologies Corp. ph: 250.717.0200 fx: 250.763.1759 http://www.wavefire.com