Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cu1qy-0006Lh-MN for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Mar 2017 19:04:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cu1qy-0000sJ-8f for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Mar 2017 19:04:56 +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.84_2) (envelope-from ) id 1cu1qG-0005ci-Dd for pgsql-bugs@postgresql.org; Fri, 31 Mar 2017 19:04:12 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cu1qD-0005G8-G0 for pgsql-bugs@postgresql.org; Fri, 31 Mar 2017 19:04:11 +0000 Received: from [192.168.127.1] (port=54052 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1cu1qA-000DNR-I5; Fri, 31 Mar 2017 19:04:06 +0000 Received: from [127.0.0.1] (port=11140 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1cu1q9-000JBK-Pm; Fri, 31 Mar 2017 19:04:05 +0000 From: Andrew Gierth To: lucas@lucas-nussbaum.net Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14608: no index scan with NOT IN and ENUM In-Reply-To: <20170331185301.2690.64421@wrigleys.postgresql.org> (lucas@lucas-nussbaum.net's message of "Fri, 31 Mar 2017 18:53:01 +0000") Message-ID: <874ly95ky8.fsf@news-spur.riddles.org.uk> References: <20170331185301.2690.64421@wrigleys.postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Fri, 31 Mar 2017 20:04:04 +0100 MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >>>>> "lucas" == lucas writes: lucas> I would expect postgresql to figure out that "not in ('1', '2', lucas> '3', '4')" is equivalent to "d = '0'" given that the column is lucas> NOT NULL. And use the index. Well, whatever you expect, nobody has ever written code for the planner to make it figure that out (and it doesn't seem likely to be a major win, so probably not surprising that nobody did it). So this is not a bug. -- Andrew (irc:RhodiumToad) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs