From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Jeremy Finzel <finzelj@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Slow planning time for simple query
Date: Wed, 6 Jun 2018 13:21:05 -0700
Message-ID: <91862f3c-40ec-5aeb-c721-56713263cd06@aklaver.com> (raw)
In-Reply-To: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com>
References: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com>
On 06/06/2018 09:59 AM, Jeremy Finzel wrote:
> Hello -
>
> We have an odd scenario on one of our OLTP systems, which behaves the
> same way on a streamer, of a 700-1000ms planning time for a query like this:
>
> SELECT *
> FROM table1
> WHERE source_id IN (SELECT id FROM table2 WHERE customer_id = $1);
>
> The actual execution time is sub-ms.
I am trying to sort out the various references to times so could you:
Show the EXPLAIN ANALYZE?
and ?
psql> \timing
psql> SELECT *
FROM table1
WHERE source_id IN (SELECT id FROM table2 WHERE customer_id = $1);
>
> We initially thought maybe catalog bloat? But we were able to reindex
> all of the highly churned catalog tables, and I even did VACUUM FULL on
> pg_attribute and pg_statistic, to no avail.
>
> There are no custom settings for pg_attribute for the given tables either.
>
> Interestingly, the problem goes away on a SAN snapshot of the target system.
>
> Any ideas of what else we could try? A PL function that caches the
> query plan works, but that is just a workaround.
>
> Thanks!
> Jeremy
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, finzelj@gmail.com
Subject: Re: Slow planning time for simple query
In-Reply-To: <91862f3c-40ec-5aeb-c721-56713263cd06@aklaver.com>
References: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com> <91862f3c-40ec-5aeb-c721-56713263cd06@aklaver.com>
* 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