From: Michael Paquier <michael.paquier@gmail.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Nandakumar M <m.nanda92@gmail.com>
Cc: pgsql-performa. <pgsql-performance@postgresql.org>
Subject: Re: Query is slow when run for first time; subsequent execution is fast
Date: Thu, 18 Jan 2018 10:55:32 +0900
Message-ID: <20180118015532.GE29962@paquier.xyz> (raw)
In-Reply-To: <CAMkU=1zFFxF74BVpwbsT1s-yY-KmW8Ya6CZkM0PDfvZ8uupF9A@mail.gmail.com>
References: <CANcFUu4e1zZQCvt9rjQGNUFV-kxv7F8Somk5Zgq2tXCO9dZhDg@mail.gmail.com>
<CAMkU=1yiULP9Gdy1pT2bpVomi4cinNGz8d7-7y+chBOQFg3f6Q@mail.gmail.com>
<CANcFUu611kaPfH+2F3pxGNX3x9jM-QiCTuS+4pzTeLL50+5s3w@mail.gmail.com>
<CAMkU=1zFFxF74BVpwbsT1s-yY-KmW8Ya6CZkM0PDfvZ8uupF9A@mail.gmail.com>
On Tue, Jan 16, 2018 at 09:18:25PM -0800, Jeff Janes wrote:
> 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?
Another thing that you could use here is pg_buffercache which offers a
way to look at the Postgres shared buffer contents in real-time:
https://www.postgresql.org/docs/current/static/pgbuffercache.html
As Jeff says, pg_prewarm is a good tool for such cases to avoid any kind
of warmup period when a server starts..
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../20180118015532.GE29962@paquier.xyz/2-signature.asc)
download
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: michael.paquier@gmail.com, jeff.janes@gmail.com, m.nanda92@gmail.com
Subject: Re: Query is slow when run for first time; subsequent execution is fast
In-Reply-To: <20180118015532.GE29962@paquier.xyz>
* 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