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 1gmIvm-0007M0-JF for pgsql-performance@arkaria.postgresql.org; Wed, 23 Jan 2019 13:51: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 1gmIvl-0000mc-5Y for pgsql-performance@arkaria.postgresql.org; Wed, 23 Jan 2019 13:51:01 +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 1gmIvk-0000kW-P3 for pgsql-performance@lists.postgresql.org; Wed, 23 Jan 2019 13:51:00 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmIvd-0005nX-K2 for pgsql-performance@postgresql.org; Wed, 23 Jan 2019 13:50:59 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 4DC571193ED85 for ; Wed, 23 Jan 2019 06:50:52 -0700 (MST) Date: Wed, 23 Jan 2019 06:50:52 -0700 (MST) From: Jim Finnerty To: pgsql-performance@postgresql.org Message-ID: <1548251452315-0.post@n3.nabble.com> In-Reply-To: References: Subject: Re: SELECT performance drop 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 One thing that isn't helping is that you have a redundant predicate. The selectivity of this predicate is also estimated too low, so removing the redundant predicate might improve the estimate and change the plan: ( " + " o.consumer IS NULL " + " ) OR ( " + " o.consumer IS NOT NULL " + " AND o.consumer > 0 remove "o.consumer IS NOT NULL AND", which is implied by o.consumer > 0. This predicate should have been automatically removed, but the filter shown in depesz shows that it was not. If you can find out what the faster plan was, that would be helpful to know. ----- Jim Finnerty, AWS, Amazon Aurora PostgreSQL -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html