Re: Should from_collapse be switched off? (queries 10 times faster)

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Should from_collapse be switched off? (queries 10 times faster)
Date: 2018-03-26 17:13:21
Message-ID: 1522084401.3179.25.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

True.
I had assumed you were speaking about the duration of the EXPLAIN (ANALYZE).

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

It is an option, although not one that makes one happy.

You might have to revisit the decision if the data distribution changes
and the chosen query plan becomes inefficient.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Glenn Pierce 2018-03-27 14:14:30 Slow query on partitioned table.
Previous Message Peter 2018-03-26 10:36:13 Re: Should from_collapse be switched off? (queries 10 times faster)