pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerry Sievers <gsievers19@comcast.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Jeremy Finzel <finzelj@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Slow planning time for simple query
Date: Wed, 06 Jun 2018 17:13:08 -0500
Message-ID: <87efhjimx7.fsf@jsievers.enova.com> (raw)
In-Reply-To: <22136.1528312205@sss.pgh.pa.us>
References: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com>
	<CAFj8pRDcdnYtM811VOO9BcTf6QJLuH=tKtCLC3rSXL8Ld4d=Zg@mail.gmail.com>
	<22136.1528312205@sss.pgh.pa.us>

Tom Lane <tgl@sss.pgh.pa.us> writes:

> Pavel Stehule <pavel.stehule@gmail.com> writes:
>
>> 2018-06-06 18:59 GMT+02:00 Jeremy Finzel <finzelj@gmail.com>:
>>> 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);
>
>> more times I seen similar issue based on bloated indexes on table - pg in
>> planning time detect min max from possible indexes
>
> Oh, hmm, yeah it could be ye olde get_actual_variable_range() issue.
> When this happens, are there perhaps a lot of recently-dead rows at either
> extreme of the range of table1.source_id or table2.id?

We noticed the cluster of interest had a rogue physical rep slot holding
71k WAL segments.

Dropping same slot seemed to correlate with the problem going away.

Does that sound like a plausible explanation for the observed slow
planning times?

Thx



> We made a fix last year to improve that:
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=3ca930fc3
> but it wasn't back-patched.
>
> 			regards, tom lane
>
>

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800




view thread (22+ messages)  latest in thread

Message-ID: <87efhjimx7.fsf@jsievers.enova.com>
Permalink:  ../87efhjimx7.fsf@jsievers.enova.com/
Also on:    postgresql.org/message-id/87efhjimx7.fsf@jsievers.enova.com

 · 

reply

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: gsievers19@comcast.net, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, finzelj@gmail.com
  Subject: Re: Slow planning time for simple query
  In-Reply-To: <87efhjimx7.fsf@jsievers.enova.com>
  References: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com> <CAFj8pRDcdnYtM811VOO9BcTf6QJLuH=tKtCLC3rSXL8Ld4d=Zg@mail.gmail.com> <22136.1528312205@sss.pgh.pa.us> <87efhjimx7.fsf@jsievers.enova.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