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 1v0j6H-00HRsl-1H for pgsql-performance@arkaria.postgresql.org; Mon, 22 Sep 2025 16:09:13 +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 1v0j6E-001Nqf-D9 for pgsql-performance@arkaria.postgresql.org; Mon, 22 Sep 2025 16:09:10 +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 1v0j6E-001NqW-1a for pgsql-performance@lists.postgresql.org; Mon, 22 Sep 2025 16:09:10 +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 1v0j69-002DjK-2g for pgsql-performance@lists.postgresql.org; Mon, 22 Sep 2025 16:09:09 +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 77EDC2768F; Mon, 22 Sep 2025 18:09:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1758557345; bh=sqFfBdu/HGadzGjvt7arSJivbnhkp8rTU73APbvReEE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iAr2bja3jNecXbVI3E0wlWS9Cu1JwvRP6U3E2rQyYrB5ZWq6oQmjAB+636iCB9Cja PlzpoPvA+h0JtLCIvMMhdvd9rg93LQvedlMrmQiJdetpQBmNxC89svFAdbZtEbtnV7 8W35Zq1JP/SCGhgc3dXc6rtQ4u06yDQ8IbleVy9U= Message-ID: <493a013c-63d1-467a-b9ec-352f77baf37a@dalibo.com> Date: Mon, 22 Sep 2025 18:09:05 +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> 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/22/25 15:57, Andrei Lepikhov wrote: > On 22/9/2025 15:37, Frédéric Yhuel wrote: >> I wonder if this is an argument in favour of decoupling the sample >> size and the precision of the statistics. Here, we basically want the >> sample size to be as big as the table in order to include the few >> (NULL, WARNING) values. > I also have seen how repeating ANALYZE on the same database drastically > changes query plans ;(. > It seems to me that with massive samples, many of the ANALYZE algorithms > should be rewritten. In principle, statistical hooks exist. So, it is > possible to invent an independent table analyser which will scan the > whole table to get precise statistics. > Interesting! I wonder how difficult it would be. However, in this specific case, I realised that it wouldn't solve the issue of ANALYZE being triggered when there are zero rows with (ackid, crit) = (NULL, WARNING). Partitioning would still work in this case, though, because ackid's null_frac would be zero for the partition containing the 'WARNING' value. I wonder if we could devise another kind of extended statistic that would provide these "partitioned statistics" without actually partitioning.