Re: Slow planning time for simple query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Slow planning time for simple query
Date: 2018-06-06 17:12:13
Message-ID: 13756.1528305133@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeremy Finzel <finzelj(at)gmail(dot)com> writes:
> 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);

Hm. Is this the first query executed in a session? If so maybe it's
got something to do with populating caches and other session spin-up
overhead.

Another theory is it's some sort of locking issue. Turning on
log_lock_waits, and setting deadlock_timeout to say 100ms, would help
in investigating that.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2018-06-06 17:13:01 Re: Which backend using which pg_temp_N schema?
Previous Message Jeremy Finzel 2018-06-06 16:59:23 Slow planning time for simple query