pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Kratz <chris.kratz@vistashare.com>
To: Darcy Buskermolen <darcy@wavefire.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Large time difference between explain analyze and normal run
Date: Thu, 10 Feb 2005 15:25:09 -0500
Message-ID: <200502101525.09165.chris.kratz@vistashare.com> (raw)
In-Reply-To: <200502101209.42079.darcy@wavefire.com>
References: <200502101334.40341.chris.kratz@vistashare.com>
	<28553.1108061917@sss.pgh.pa.us>
	<200502101209.42079.darcy@wavefire.com>

On Thursday 10 February 2005 03:09 pm, Darcy Buskermolen wrote:
> On February 10, 2005 10:58 am, Tom Lane wrote:
> > Chris Kratz <chris.kratz@vistashare.com> 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



view thread (5+ messages)

Message-ID: <200502101525.09165.chris.kratz@vistashare.com>
Permalink:  ../200502101525.09165.chris.kratz@vistashare.com/
Also on:    postgresql.org/message-id/200502101525.09165.chris.kratz@vistashare.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: chris.kratz@vistashare.com, darcy@wavefire.com, tgl@sss.pgh.pa.us
  Subject: Re: Large time difference between explain analyze and normal run
  In-Reply-To: <200502101525.09165.chris.kratz@vistashare.com>
  References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> <200502101209.42079.darcy@wavefire.com> <200502101525.09165.chris.kratz@vistashare.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox