pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 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 15:10:05 -0400
Message-ID: <22136.1528312205@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRDcdnYtM811VOO9BcTf6QJLuH=tKtCLC3rSXL8Ld4d=Zg@mail.gmail.com>
References: <CAMa1XUhVCj1ZRB6XqC81MZrnb3biJfq4eR3tY5Bt1nP-YhrUBg@mail.gmail.com>
	<CAFj8pRDcdnYtM811VOO9BcTf6QJLuH=tKtCLC3rSXL8Ld4d=Zg@mail.gmail.com>

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 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




view thread (22+ messages)  latest in thread

Message-ID: <22136.1528312205@sss.pgh.pa.us>
Permalink:  ../22136.1528312205@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22136.1528312205@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, finzelj@gmail.com
  Subject: Re: Slow planning time for simple query
  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>

* 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