Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezNTC-00009R-Jz for pgsql-performance@arkaria.postgresql.org; Fri, 23 Mar 2018 14:15:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ezNTB-00044C-CJ for pgsql-performance@arkaria.postgresql.org; Fri, 23 Mar 2018 14:15:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezNTB-000443-4K for pgsql-performance@lists.postgresql.org; Fri, 23 Mar 2018 14:15:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ezNT6-0000MU-FT for pgsql-performance@lists.postgresql.org; Fri, 23 Mar 2018 14:15:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2NEEJsq018406; Fri, 23 Mar 2018 10:14:19 -0400 From: Tom Lane To: Laurenz Albe cc: Peter , pgsql-performance@lists.postgresql.org Subject: Re: Should from_collapse be switched off? (queries 10 times faster) In-reply-to: <1521805295.2471.40.camel@cybertec.at> References: <20180323100308.GA1188@gate.oper.dinoex.org> <1521805295.2471.40.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Fri, 23 Mar 2018 12:41:35 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18404.1521814459.1@sss.pgh.pa.us> Date: Fri, 23 Mar 2018 10:14:19 -0400 Message-ID: <18405.1521814459@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laurenz Albe writes: > Peter wrote: >> I could not find any documentation or evaluation that would say >> that from_collapse can have detrimental effects. Even less, which >> type of queries may suffer from that. > 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. It's conceivable that the OP's problem is actually planning time (if the query joins sufficiently many tables) and that restricting the cost of the join plan search is really what he needs to do. Lacking any further information about the problem, we can't say. We can, however, point to https://wiki.postgresql.org/wiki/Slow_Query_Questions concerning how to ask this type of question effectively. regards, tom lane