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 1gIiI9-00043W-3w for pgsql-performance@arkaria.postgresql.org; Fri, 02 Nov 2018 22:51:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIiI6-0007YU-Rz for pgsql-performance@arkaria.postgresql.org; Fri, 02 Nov 2018 22:51:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIiI6-0007YN-99 for pgsql-performance@lists.postgresql.org; Fri, 02 Nov 2018 22:51:46 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIiI2-0000xa-0i for pgsql-performance@postgresql.org; Fri, 02 Nov 2018 22:51:44 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 907C7100FE3D7 for ; Fri, 2 Nov 2018 15:51:40 -0700 (MST) Date: Fri, 2 Nov 2018 15:51:40 -0700 (MST) From: legrand legrand To: pgsql-performance@postgresql.org Message-ID: <1541199100540-0.post@n3.nabble.com> In-Reply-To: <8db7abc2-9ddf-858c-e3db-af014cf2ccd9@2ndquadrant.com> References: <8db7abc2-9ddf-858c-e3db-af014cf2ccd9@2ndquadrant.com> Subject: Re: Fwd: Query with high planning time compared to execution time MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra-4 wrote > On 11/02/2018 10:36 AM, Richard Lee wrote: > [...] > >> What are my other options to improve the query planning time? >> > > Can you do a bit of profiling, to determine which part of the query > planning process is slow here? > [...] After planning profiling, (or in //), you can try to limit the number of plans that the planner has to evaluate: setting enable_mergejoin to off, or some others from https://www.postgresql.org/docs/10/static/runtime-config-query.html but you will have to check that the chosen plan is still good An other way is maybe reducing the number of indexes (you have so many ones ...). Usually, needed indexes are PK, UK, indexes for FK, and a "few" more. Could you provide the SQL query to check that ? Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html