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 1gVGER-0008Gm-Mj for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Dec 2018 13:31:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gVGEQ-0000dd-1o for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Dec 2018 13:31:50 +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 1gVGEP-0000dV-OK for pgsql-bugs@lists.postgresql.org; Fri, 07 Dec 2018 13:31:49 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gVGEI-0000m5-L7 for pgsql-bugs@postgresql.org; Fri, 07 Dec 2018 13:31:48 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 9B88210AB16AB for ; Fri, 7 Dec 2018 06:31:41 -0700 (MST) Date: Fri, 7 Dec 2018 06:31:41 -0700 (MST) From: Jim Finnerty To: pgsql-bugs@postgresql.org Message-ID: <1544189501635-0.post@n3.nabble.com> In-Reply-To: <15538-cbf9af6df1621824@postgresql.org> References: <15538-cbf9af6df1621824@postgresql.org> Subject: Re: BUG #15538: Postgres query performance is slow. 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 I don't see evidence of a bug here (so far), but a couple of things are worthy of mention: - The estimated number of rows is much higher than the actual. A likely cause of this under-estimation is that the columns are correlated. If so, then the estimate may be improved in PG10+ by collecting multi-column statistics on (id, time) or (id, time, isValid), but that doesn't help you on PG9.6 - For the historic partitions that are no longer being updated, you could cluster the heap by the index, and possibly disable the bitmap heap scan. If either or both of these changes improve scan performance significantly on the 2017 data, consider partitioning by month and clustering historic monthly partitions. ----- Jim Finnerty, AWS, Amazon Aurora PostgreSQL -- Sent from: http://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html