[GENERAL] How to evaluate "explain analyze" correctly after "explain" for thesame statement ? - Mailing list pgsql-general

From Patrick B
Subject [GENERAL] How to evaluate "explain analyze" correctly after "explain" for thesame statement ?
Date
Msg-id CAJNY3ivJ+Gw_2fWjkOnbU7EZqLT8G=KNwkGt8yJxEw9mRAV0Zg@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] How to evaluate "explain analyze" correctly after"explain" for the same statement ?  (Steve Atkins <steve@blighty.com>)
List pgsql-general
Hi all,

I just got a quick question about warm-cache. I'm using PG 9.2.

When I execute this statement soon after I start/restart the database:

explain select id from test where id = 124;

The runtime is 40ms.

Then, If I execute this statement just after the above one;

explain analyze select id from test where id = 124;

The runtime is 0.8ms.

Probably the statement is cached, right?


So, I do (To clear the cache):

  • service postgresql stop
  • echo 3 > /proc/sys/vm/drop_caches
  • service postgresql start
But, then, executing the statement again, it runs in 0.8 ms. 

How can I clean the cache to get the REAL runtime for that statement?
Thanks
Patrick

pgsql-general by date:

Previous
From: "David O'Mahony"
Date:
Subject: [GENERAL] Potential Bug: Frequent Unnecessary Degeneration
Next
From: Andres Freund
Date:
Subject: Re: [GENERAL] Potential Bug: Frequent Unnecessary Degeneration