Re: How to evaluate "explain analyze" correctly soon after "explain" for the same statement ?

From: 高健 <luckyjackgao(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to evaluate "explain analyze" correctly soon after "explain" for the same statement ?
Date: 2012-11-08 05:05:45
Message-ID: CAL454F2gXoykXOQ4mJfLsqdzZNXKpZXUsHALpGkEeNa4ntEo8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi tom

At frist I have thought that the database parsed my explain statement,
so the pre-compiled execution plan will be re-used , which made the
statement's second run quick.

I think that what you said is right.

Thank you

2012/11/7 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>

> =?UTF-8?B?6auY5YGl?= <luckyjackgao(at)gmail(dot)com> writes:
> > It might not be a big problem in a small system.
> > But when in a production environment, When I want to use explain and
> > then , soon use explain analyze for the same statement,
> > How can I avoid the influence of cache and get the right answer for
> > evaluating purpose?
>
> I think this question is based on a false premise. Why do you feel that
> the behavior with cold caches is "the right answer", and not the behavior
> with warm caches? A short-duration query like this one is not going to
> be interesting at all for performance unless it's executed quite a lot,
> and if it's executed quite a lot then the warm-cache result ought to be
> the more representative one.
>
> In general, trying to tune for cold-cache cases seems backwards to me.
> It's much more productive to try to ensure that the caches are warm.
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2012-11-08 06:00:33 Re: Does PostgreSQL have complete functional test cases?
Previous Message Scott Marlowe 2012-11-08 02:03:59 Re: Unexpectedly high disk space usage