Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJJRM-00028h-3x for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 16:08:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJJRL-0003kE-1P for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 16:08:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJJRK-0003jc-QQ for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 16:08:34 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJJRI-0003yu-Bd for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 16:08:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 211ABA9B; Tue, 31 Mar 2020 12:08:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 31 Mar 2020 12:08:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imap.cc; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Q RC21U0lnQ0XlG5tfxGliCh0mEUWfHMweckUUpuE9V0=; b=U93UdTOxjEdEiZZfx NyZHnXAEnf+Qvop6HV+v/otpX+9aN/nJfGUg4bTWDNJu7Ry4KDgFtWaZ8Wm5lR+I WchTaZgiesOK8dWWctf2UQpKcfzKOCOPmKy+MGdiW3NnF4/qt9xsAAuPRNMdQNLZ pJdQz2wBgEc/dOb+9VTYZmekGxn0IF86/bT6Id6zkPxr/DjUXBdAGQFsCjylUtAo PvJd8F4yVE8ZczlD6+8Vm6kJyoMijTmUIdRMYB46UY55lnIK3wf/uN7JRk06w7rU gjOavxKuzLWDIUrxfZq/W+GqQ7wDA4P4puQESQxqzq/u21j21eYpXGF3AH6EQb1r Ma0rA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=QRC21U0lnQ0XlG5tfxGliCh0mEUWfHMweckUUpuE9 V0=; b=ITyGSsrPQ3byqQZHxzvCLGO9kUuQTUPTkJ60Q8aiLOnv8mxlqaAzNDPJe h++67PeBCMZrS7xiffVrPdcKymMAdsg066eUsanhmxyb2Z3Bc+KeRE3L4LAu64Fy 1tgBNXlChJbIfamoa3ak/8kumcpRaSN6i8x9rxT4j/76xhULYkYm9Im4sZ4lPKEG OvLQs0qWci/SKxj7KA4M3Lgk0Y7lBTApGkUwLtGIkRKBr8dnPpzhKRMJRegpJj/h YU99DHUKmmV0+eITSMkFq5rCiqSWWxkUBcBUwiJWA/fYlI2R9gQwwrnSKsyRosk0 0SuppOM702thOC9sWgyjv3FFq3DOQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtddtgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdeftddmnecujfgurhepuffvfh fhkffffgggjggtgfesthejredttdefheenucfhrhhomheptehlvgigvgihuceurghshhht rghnohhvuceosggrshhhthgrnhhovhesihhmrghprdgttgeqnecukfhppeelvddrgedtrd dvgeekrdduledunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepsggrshhhthgrnhhovhesihhmrghprdgttg X-ME-Proxy: Received: from ev9d9.btn1.brandwatch.net (92.40.248.191.threembb.co.uk [92.40.248.191]) by mail.messagingengine.com (Postfix) with ESMTPA id A13C33280063; Tue, 31 Mar 2020 12:08:27 -0400 (EDT) Subject: Re: Less-silly selectivity for JSONB matching operators To: Tom Lane , pgsql-hackers@lists.postgresql.org References: <12237.1582833074@sss.pgh.pa.us> <14469.1582927774@sss.pgh.pa.us> From: Alexey Bashtanov Message-ID: Date: Tue, 31 Mar 2020 17:08:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <14469.1582927774@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Quickly tested like this: create table t(a jsonb); insert into t select jsonb_object( array[(random() * 10)::int::text], '{" "}') from generate_series(1, 100000); insert into t select jsonb_object( array[(random() * 10)::int::text], array[(random() * 1000)::int::text]) from generate_series(1, 100000); explain analyze select * from t where a ? '1'; analyze t; explain analyze select * from t where a ? '1'; Best, Alex