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 1uyuA9-00EJ2Y-SS for pgsql-performance@arkaria.postgresql.org; Wed, 17 Sep 2025 15:33:41 +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 1uyuA7-008fdn-Kk for pgsql-performance@arkaria.postgresql.org; Wed, 17 Sep 2025 15:33:40 +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 1uyuA7-008fde-Ac for pgsql-performance@lists.postgresql.org; Wed, 17 Sep 2025 15:33:40 +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 1uyuA4-001LLc-01 for pgsql-performance@lists.postgresql.org; Wed, 17 Sep 2025 15:33:39 +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 02D5E27B0A; Wed, 17 Sep 2025 17:33:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1758123216; bh=LiEZuvbLCcDAeb0iZIrt/sz6S90JtlCyZG+GR+9I+jQ=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=PM4yBp4IXQThCeau3LSMDPBUlDaLenjihc4slN2dixeMj5gmZ09BXnVHctEhX1TrB PlYmiCzpaS2DoTWR1h51qG9DWgXUsP5ykne36x2joGoKfNv4GBM7reP1PMCP4zUngS 0C7xllPGyXX+4CHwOZKp8alaB8LBQEMa4KQwwgk0= Message-ID: <9a3389fe-fbc8-4e40-9a35-691bc35d043d@dalibo.com> Date: Wed, 17 Sep 2025 17:33:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Indexes on expressions with multiple columns and operators From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= To: 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> Content-Language: 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: <62133334-b844-4d0b-b248-1a8446757e5f@dalibo.com> 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/17/25 16:57, Frédéric Yhuel wrote: > Yes, Laurenz made a similar suggestion, but the problem is that I'm > mostly interested in the estimated number of output rows... because in > the real query, there's a very bad Hash Join above (the Nested Loop is > *much* faster). BTW, I've also tested another solution: partitioning on 'criticity', with one partition for 'INFO' (99% of the rows), and another one for the other values ('WARNING' and 'ALARM' in the real case). The statistics are much better... however an expression index would be an easier fix. Multivariate MCV statistics don't work well in the real case (100M lines in the table).