[GENERAL] How to evaluate "explain analyze" correctly after "explain" for thesame statement ?

Поиск
Список
Период
Сортировка
От Patrick B
Тема [GENERAL] How to evaluate "explain analyze" correctly after "explain" for thesame statement ?
Дата
Msg-id CAJNY3ivJ+Gw_2fWjkOnbU7EZqLT8G=KNwkGt8yJxEw9mRAV0Zg@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GENERAL] How to evaluate "explain analyze" correctly after"explain" for the same statement ?  (Steve Atkins <steve@blighty.com>)
Список 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 по дате отправления:

Предыдущее
От: "David O'Mahony"
Дата:
Сообщение: [GENERAL] Potential Bug: Frequent Unnecessary Degeneration
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [GENERAL] Potential Bug: Frequent Unnecessary Degeneration