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

From: Peter <pmc(at)citylink(dot)dinoex(dot)sub(dot)org>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Should from_collapse be switched off? (queries 10 times faster)
Date: 2018-03-23 14:30:52
Message-ID: 20180323143052.GA30371@gate.oper.dinoex.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Mar 23, 2018 at 12:41:35PM +0100, Laurenz Albe wrote:

! https://www.postgresql.org/docs/current/static/explicit-joins.html
! states towards the end of the page that the search tree grows
! exponentially with the number of relations, and from_collapse_limit
! can be set to control that.

Yes, I read that page.

! > In my case, planning uses 1 or 2% of the cycles needed for
! > execution; that seems alright to me.
! > And, as said above, I cannot see why my queries might be an
! > atypical case (I don't think they are).
! >
! > If somebody would like to get a hands-on look onto the actual
! > case, I'd be happy to put it online.
!
! It seems like you are barking up the wrong tree.
!
! Your query does not take long because of the many relations in the
! FROM list, but because the optimizer makes a wrong choice.

Exactly!
And I am working hard in order to understand WHY this happens.

! The correct solution is *not* to set from_collapse_limit = 1, but
! to find and fix the problem that causes the optimizer to make a
! wrong choice.
!
! If you send the query and the output of
! EXPLAIN (ANALYZE, BUFFERS) SELECT ...
! we have a chance of telling you what's wrong.

Your viewpoint would be preferrable, only I am lacking any idea on
where there could be such a problem that would make up a root cause.

I will gladly follow Your suggestion; data is underway.

P.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2018-03-23 15:08:56 Re: DB corruption
Previous Message Peter 2018-03-23 14:30:21 Re: Should from_collapse be switched off? (queries 10 times faster)