RE: Query is slow when run for first time; subsequent execution isfast

Поиск
Список
Период
Сортировка
От POUSSEL, Guillaume
Тема RE: Query is slow when run for first time; subsequent execution isfast
Дата
Msg-id DB5PR0201MB15758B7FA662A6B04509AE359CE90@DB5PR0201MB1575.eurprd02.prod.outlook.com
обсуждение исходный текст
Ответ на Re: Query is slow when run for first time; subsequent execution is fast  (Jeff Janes <jeff.janes@gmail.com>)
Ответы RE: Query is slow when run for first time; subsequent execution is fast
Список pgsql-performance

Hello,

 

FWIW, I do have the same issue.

Unfortunately our application is running on a standard laptop/desktop computers, not dedicated servers.

Restarting the computer leads to a restart of the database server, which slow down all queries for several minutes.

 

Are you on Windows or Linux? I’m on Windows and wondering if the issue is the same on Linux?

 

BR,

Guillaume

 

 

De : Jeff Janes [mailto:jeff.janes@gmail.com]
Envoyé : mercredi 17 janvier 2018 06:18
À : Nandakumar M
Cc : pgsql-performa.
Objet : Re: Query is slow when run for first time; subsequent execution is fast

 

On Fri, Jan 12, 2018 at 12:03 AM, Nandakumar M <m.nanda92@gmail.com> wrote:

Hello Jeff,

 

Thanks for the insights.

 

>Don't keep closing and reopening connections.

 

Even if I close a connection and open a new one and execute the same query, the planning time is considerably less than the first time. Only when I restart the Postgres server then I face high planning time again.

 

Oh.  I've not seen that before.  But then again I don't often restart my server and then immediately run very large queries with a stringent time deadline.

 

You can try pg_prewarm, on pg_statistic table and its index.  But I'd probably just put an entry in my db startup script to run this query immediately after startng the server, and let the query warm the cache itself.

 

Why do you restart your database often enough for this to be an issue?

 

Cheers,

 

Jeff

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Вложения

В списке pgsql-performance по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: Query is slow when run for first time; subsequent execution is fast
Следующее
От: Nandakumar M
Дата:
Сообщение: RE: Query is slow when run for first time; subsequent execution is fast