Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1buP-000373-HR for pgsql-performance@arkaria.postgresql.org; Sat, 24 Aug 2019 19:41:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i1buO-0005w5-BI for pgsql-performance@arkaria.postgresql.org; Sat, 24 Aug 2019 19:41:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1buN-0005ub-VZ for pgsql-performance@lists.postgresql.org; Sat, 24 Aug 2019 19:41:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i1buL-0005hU-MY for pgsql-performance@postgresql.org; Sat, 24 Aug 2019 19:41:06 +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 x7OJf3kx006840; Sat, 24 Aug 2019 15:41:03 -0400 From: Tom Lane To: Jeff Janes cc: Pavel Stehule , =?UTF-8?Q?Felix_Geisend=C3=B6rfer?= , "pgsql-performa." Subject: Re: Extremely slow HashAggregate in simple UNION query In-reply-to: References: <9ADCDD19-555B-4DB0-B00C-1852AC361557@felixge.de> Comments: In-reply-to Jeff Janes message dated "Sat, 24 Aug 2019 15:16:10 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6838.1566675663.1@sss.pgh.pa.us> Date: Sat, 24 Aug 2019 15:41:03 -0400 Message-ID: <6839.1566675663@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeff Janes writes: > Most of the time is not after the clock stops, but before the stepwise > ANALYZE clock starts. If you just do an EXPLAIN rather than EXPLAIN > ANALYZE, that is also slow. The giant hash table is created during the > planning step (or somewhere around there It's in executor startup, I believe. regards, tom lane