Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v108i-003Qm5-7h for pgsql-performance@arkaria.postgresql.org; Tue, 23 Sep 2025 10:20:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v108g-004qFn-UO for pgsql-performance@arkaria.postgresql.org; Tue, 23 Sep 2025 10:20:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v108g-004qFf-K5 for pgsql-performance@lists.postgresql.org; Tue, 23 Sep 2025 10:20:50 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v108b-002MBI-35 for pgsql-performance@lists.postgresql.org; Tue, 23 Sep 2025 10:20:50 +0000 Received: from [192.168.1.11] (5-49-10-71.hfc.dyn.abo.bbox.fr [5.49.10.71]) by mail.dalibo.com (Postfix) with ESMTPSA id 42FA527124; Tue, 23 Sep 2025 12:20:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1758622845; bh=S8OwZd5GnlOz29bNGNE9GxfZ3edxi4qyKiS1NPfUZw4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iYsRJaKsTyALTvcrCKwNycRtoisovlD11Yph9GkgeKhU4+yrMFoyAL1HBdJHCOPLi HT67baIZiW+6BzmYslNStB66PXPsn1v6REDbkBVPPodHVmkbn3cxTJCcpMBLBeGpAI YRiTaez5VPnZUQN3ol1sCoL8iWFUPxoE858FXdfY= Message-ID: Date: Tue, 23 Sep 2025 12:20:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Indexes on expressions with multiple columns and operators To: Andrei Lepikhov , Tom Lane Cc: "pgsql-performance@lists.postgresql.org" , Jehan-Guillaume de Rorthais , Christophe Courtois , Laurenz Albe References: <1507576.1758120083@sss.pgh.pa.us> <62133334-b844-4d0b-b248-1a8446757e5f@dalibo.com> <1916727.1758209549@sss.pgh.pa.us> <1972974.1758213639@sss.pgh.pa.us> <76fbd9ef-1fbb-49f0-bc8b-844462b18d1d@dalibo.com> <2432873.1758387110@sss.pgh.pa.us> <6ad08c0c-2c03-4b30-b5a7-dc486aa29c52@dalibo.com> <493a013c-63d1-467a-b9ec-352f77baf37a@dalibo.com> <9756a3e9-5dea-4506-a077-72a4d9c302df@gmail.com> From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= Content-Language: fr, en-US Autocrypt: addr=frederic.yhuel@dalibo.com; keydata= xjMEXn3bgxYJKwYBBAHaRw8BAQdA6tX5FT/n5ztMWIoBdl6k5avvu65fv6ryfVzIx/aH3V3N JEYuIFlodWVsIDxmcmVkZXJpYy55aHVlbEBkYWxpYm8uY29tPsKWBBMWCAA+FiEEi7OTyf6H ePS+C6n11XGWhN8zGNUFAmZDVJ8CGwMFCQtfi90FCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQ1XGWhN8zGNV65gEA6o+UrebFjn2CIAOYwP3CiiJugiM5TMH9yJyehQua5ZoA/2ChxiVn 8OUaAw/ErxJmQi1mSN0tNZBL/KhkUPBDUDQNzjgEXn3bgxIKKwYBBAGXVQEFAQEHQCuh5cLQ AtEBXHa2Fmtp0kduBu7msM7qO/gaEcdjFUdiAwEIB8J+BBgWCAAmAhsMFiEEi7OTyf6HePS+ C6n11XGWhN8zGNUFAmZDVJ8FCQtfi90ACgkQ1XGWhN8zGNWOOAEArSqePBqfd4Kx4ulACaWO 6fM+XSDfUlBAQXx9rU6DR4MBALwozl9g91tRysim6lKxggvBfp/PvbpTZNrxYLWB2fYP In-Reply-To: <9756a3e9-5dea-4506-a077-72a4d9c302df@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/22/25 23:15, Andrei Lepikhov wrote: > I'm not sure I fully understand your case, but SQL Server demonstrates > an interesting approach: they have a WHERE clause attached to > statistics. So, having implemented this, you may separate the whole > range of values inside the table into 'partitions' by such a WHERE > condition. Yes, from what I understood of the documentation [1], this is exactly what I would like! > It may solve at least one issue with the 'dependencies' statistics: a > single number describing the dependency between any two values in the > columns often leads to incorrect estimations, as I see. For what it's worth, I've never encountered a case in my life as a PostgreSQL support engineer where the 'dependency' kind could be useful. I only successfully used the 'mcv' kind once (and that was only partially successful, as it fixed the estimates but not the plan). [1] https://learn.microsoft.com/en-us/sql/t-sql/statements/create-statistics-transact-sql?view=sql-server-ver17#c-use-create-statistics-to-create-filtered-statistics