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 1gwEe1-0000pv-M0 for pgsql-general@arkaria.postgresql.org; Tue, 19 Feb 2019 23:17:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gwEe0-0001Zt-EC for pgsql-general@arkaria.postgresql.org; Tue, 19 Feb 2019 23:17:44 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwEe0-0001Zm-5t for pgsql-general@lists.postgresql.org; Tue, 19 Feb 2019 23:17:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwEdy-0002rW-6o for pgsql-general@postgresql.org; Tue, 19 Feb 2019 23:17:43 +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 x1JNHdDb027831; Tue, 19 Feb 2019 18:17:39 -0500 From: Tom Lane To: Samuel Williams cc: pgsql-general Subject: Re: Partial index on JSON column In-reply-to: <31590.1550610877@sss.pgh.pa.us> References: <31590.1550610877@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 19 Feb 2019 16:14:37 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27829.1550618259.1@sss.pgh.pa.us> Date: Tue, 19 Feb 2019 18:17:39 -0500 Message-ID: <27830.1550618259@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Try it like > EXPLAIN SELECT COUNT(*) FROM "user_event" WHERE ((parameters ->> > 'suggestion_id'::text) = '26') AND what = 'suggestion_notification'; > I don't think we assume that CoerceViaIO is strict, and without that > the deduction that the value couldn't be null doesn't hold. Hmm ... on closer inspection, we do assume that CoerceViaIO is strict, but not everyplace knows that, so there's something that could be improved here. In the meantime, try it as stated above. regards, tom lane