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.