pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter <pmc@citylink.dinoex.sub.org>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-performance@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Should from_collapse be switched off? (queries 10 times faster)
Date: Mon, 26 Mar 2018 12:36:13 +0200
Message-ID: <20180326103612.GA16180@gate.oper.dinoex.org> (raw)
In-Reply-To: <1521954728.2350.24.camel@cybertec.at>
References: <20180323100308.GA1188@gate.oper.dinoex.org>
	<1521805295.2471.40.camel@cybertec.at>
	<18405.1521814459@sss.pgh.pa.us>
	<20180323173658.GA58069@gate.oper.dinoex.org>
	<1521954728.2350.24.camel@cybertec.at>

Laurenz,

thank You very much for Your comments!

On Sun, Mar 25, 2018 at 07:12:08AM +0200, Laurenz Albe wrote:

! Your reported execution times don't match the time reported in the
! EXPLAIN output...

Should these match? 
It seems the EXPLAIN (ANALYZE, BUFFERS) does additional things, not 
just execute the query. 

! The cause of the long execution time is clear:
! 
! The row count of the join between "places" (WHERE platz = 'WAEHR'),
! "wpnames" and "places AS places_1" is underestimated by a factor of 10
! (1 row instead of 10).
! 
! The nested loop join that is chosen as a consequence is now executed
! 10 times instead of the estimated 1 time, which is where almost all the
! execution time is spent.

I've seen this, but do not fully understand it yet.
 
! Setting "enable_nestloop = off" is as coarse as forcing "from_collapse = 1"
! and will negatively impact other queries - if it helps at all.

Since this query is already put into a function, I found I can easily
set from_collapse=1 only for this function, by means of "ALTER
FUNCTION ... SET ...", so it does only influence this query. 
It seems this is the most straight-forward solution here.
 
rgds,
P.




view thread (10+ messages)  latest in thread

Message-ID: <20180326103612.GA16180@gate.oper.dinoex.org>
Permalink:  ../20180326103612.GA16180@gate.oper.dinoex.org/
Also on:    postgresql.org/message-id/20180326103612.GA16180@gate.oper.dinoex.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pmc@citylink.dinoex.sub.org, laurenz.albe@cybertec.at, tgl@sss.pgh.pa.us
  Subject: Re: Should from_collapse be switched off? (queries 10 times faster)
  In-Reply-To: <20180326103612.GA16180@gate.oper.dinoex.org>

* 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