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 1v0ntH-000mPH-0C for pgsql-performance@arkaria.postgresql.org; Mon, 22 Sep 2025 21:16:07 +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 1v0ntE-0026fM-0w for pgsql-performance@arkaria.postgresql.org; Mon, 22 Sep 2025 21:16:04 +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 1v0ntD-0026fD-N9 for pgsql-performance@lists.postgresql.org; Mon, 22 Sep 2025 21:16:03 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v0nt9-002G4k-19 for pgsql-performance@lists.postgresql.org; Mon, 22 Sep 2025 21:16:03 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-46cf7bbfda8so11694255e9.2 for ; Mon, 22 Sep 2025 14:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758575755; x=1759180555; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RsWOBbGA8IxtjfE5u2zN51dZK1YrbuZjqPdzWZ+Nap0=; b=BbDCFlwUYLkwh/lyeMyzf18mV1CwlWXG19HLtZR+eTuTWzXOU73iSuxs4LWEYf7D77 3Lyd48biugb7cfEgz1/6xpCzEfY3R7pFt+FbmJRNSQzM4Vxof+PuX0Ah+w0rjzPrJQVT 2YwyamnZxcAKTaDjB21XMdf1tEmzfhnLOYCPRVqDldyJEaCQxYl27fVPHqGI1eGTOXRz kVN7BUdpbK2Ybg0fW0XM5bWueona2ECVqvw9jz8eN9qtncWwpS2SOO3+TQvMdeWG4tMb UNa38eZPbDOpS+iI+yzgZCmUGsbCFXUWauCAow5CwL8ieHNY8el10SWY/UjteQNPCRHJ KXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758575755; x=1759180555; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RsWOBbGA8IxtjfE5u2zN51dZK1YrbuZjqPdzWZ+Nap0=; b=m+nTF+PNvQcMvb4rIe03/Iqq6u7VU73tgmRRU3y/BAOLtJ4nmkASgSqzAXPh01GhmL eRMQ8SHsy4Y0j4fbQs4q0nZedQiPSxf+cCZZIOmMk97wHvRTuVMu6va47fDLb5Hy0gay rgYYhPyxTQrg9w50gJ0P3fU/HmOW8bMXtUEIXf/y0X58qFoqLN2O2ZeRy65P5yXr2+GY L0Yw70Sp/l46Esd/RK8MU1Y6guEw08kAND+WHQMJ9JLvEbsEe+oXE+0b1MpZ1BDUnVQP NlbAcjfZ/ZpKM8GOEyY/Z3/A119w2bK1G4Cyvbp2+rFJiYI/WwcSEH4ScdPmxwlILwYf uveg== X-Gm-Message-State: AOJu0YxCxSYDsPnsNKjaR0unSr+Z+ROnrx0OdCQ84CO0g/MJUaPLFAtQ kSJZNUKeVmeGJHF9Ny0ODhzLXgMJhV2oH5MlHKHx5PHC5FNAQ0zYK3Td X-Gm-Gg: ASbGnctYm9mO51uV4MoSesr4BR3jk6C/9H7E+3DPXNFAj3g/ayOqi1ZzIFhKfF7mUqI oujXFemhKYNIAUcV3R/QeFoU25cVxFYle6xtDMjHHwUfaO4mxh82FtJFDzavbFy4WLjuKLNPYSI rq/IfSqrQlY3SPreLhl0bEDgpRFD2Cee08Rgl6duC9ObF/FSCTLixKdrragoBOJwqZaXA0dzlFh dYL/bqBvONUJb0SwD6GPuiWESoF592n8VT+zRGbuYf/StHpi/f7pj8yfnaNMXMl8CE289Y9UdGN bovwjKHvb9BI8Um+rIBMB0GVp/P9/5WUJHMXqgZdo8Gu4Ml0SYDBGmxikS5u51kCt3WMk56qg6D UKI/77d6E5diZt68GXQ4xEGYgjyV3VXy1Hfsw52798XS3RkibUav2gZyR/yJmUVWJiuIU/3KHH5 9Ah9Qk7EWq X-Google-Smtp-Source: AGHT+IHYs5M6OEHfeLIDEnqPN8VoMbm+6OQlv+6VF8awKJj5mKEEwp5rpsnsa5FcYvrdYc9vcMbhvA== X-Received: by 2002:a05:600c:1f12:b0:46d:d949:daba with SMTP id 5b1f17b1804b1-46e1d99552cmr2639785e9.4.1758575754318; Mon, 22 Sep 2025 14:15:54 -0700 (PDT) Received: from [192.168.0.211] (84.123.229.156.dyn.user.ono.com. [84.123.229.156]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4613d42bee6sm263377055e9.15.2025.09.22.14.15.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Sep 2025 14:15:53 -0700 (PDT) Message-ID: <9756a3e9-5dea-4506-a077-72a4d9c302df@gmail.com> Date: Mon, 22 Sep 2025 23:15:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Indexes on expressions with multiple columns and operators To: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= , 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> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: <493a013c-63d1-467a-b9ec-352f77baf37a@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 22/9/2025 18:09, Frédéric Yhuel wrote: > On 9/22/25 15:57, Andrei Lepikhov wrote: > I wonder if we could devise another kind of extended statistic that > would provide these "partitioned statistics" without actually partitioning.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. 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. -- regards, Andrei Lepikhov