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 1u4cn4-004tXY-PI for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Apr 2025 09:41:15 +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 1u4cn2-006w6t-EP for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Apr 2025 09:41:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4cn2-006w6l-3W for pgsql-bugs@lists.postgresql.org; Tue, 15 Apr 2025 09:41:12 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4cn0-000AZS-2O for pgsql-bugs@lists.postgresql.org; Tue, 15 Apr 2025 09:41:12 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43cfdc2c8c9so28658465e9.2 for ; Tue, 15 Apr 2025 02:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744710070; x=1745314870; 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=/3oo8tgKsHh2N7P+to2yCt8gUZDKv4ROGgPJiK6kI4A=; b=BSFo1DYuXM/DTjhlUWAehqKjnlw1oiEqHcw/0OZNuCZsW4ADIOgFLgs86fx6ZTBHK0 IrpGUHMtBFoXLYxPfXHfN42mV/lZP7rUU3z0stU5iwE5hclrz97Y/aJ8jzW/DgizH6ml JhawDQI2dwNqu4oV6CGjMUtJJlImdAVEutpj58JhxoDH1o6RLCH6zKAfidJdzxhJktM9 Y6C1RgF5ID/hLKfxWEtvVV10ytWGZgIcs4QoxaeffDiji331QRORZpuVw+YEGiDc5eS5 Bdt2im3amO+ThCvLgD0ohWGI+EcpORPizipqg3iTAqI/KCpkNHHhrojSp0n65xRjGSPk zmNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744710070; x=1745314870; 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=/3oo8tgKsHh2N7P+to2yCt8gUZDKv4ROGgPJiK6kI4A=; b=dUs1kcYe37IvGRvhiviJuI9MLq5H675ifUajooXHNUHDJ1vxratEfHtMYW1S74Yotm MXeAsWMtkIvA6cL5Ts2H3jTaFsaSZg3l1nkVBIE4sm0B6d9w9yge9pQThjvHm7fcg7WW XyYHFJMv0jq5mvb7giIlbnPg6LGaGHm8DRBWG1KxNh68xDld7MpKiDL3Bxn8JL7aoscI Tdjt6rZLMzefD3ALiSvPFrE19sttWbk4Jx6FAJCI1A/9Ctz8ivL8Dyuw/8AkCCtU67yN qbUGveFSixmXbgfDCYUUztwMI1+/TcDmxeVG9S+Y2MVBLd+4KhM4Pp3cmtxzru/vbQMt b+NA== X-Forwarded-Encrypted: i=1; AJvYcCXZ9q2EdQ1OgiVUhGAVO9WjVCQwDzLf1h5+8KSdFjQvryaAncnSuQ60DMPZkAnu9siE+iWPCCiljJSS@lists.postgresql.org X-Gm-Message-State: AOJu0Yw+r5toy07M8VYioz5rdfdhs8x+i0NFJwG434oYaMc88xt6rTsc o+m/2zG3IQnaDwAKrH/O+yDHsEtuWm0hwBmUWW5UJ41rIe+Qomr/ X-Gm-Gg: ASbGncupcH9mb7rcVs9xEt6xQD68CU4Ix/JRofMC9U7+lO9xxX3bHB4+XPK0vzF14Jv cdHSpLEw4qpRdNGxqRrqCZCJ/olIJQy3AIyTL8TGuhRY8rJOt94Q1Eu/0CWLqxW879g2k87toL0 k6lkSnbMEQSvT359b/IeVdEoWGz8kuxjrVoYvQD5ovPJJH3zNTZP/T0Zo9pIJrrBCNICHJn0wJy bgxResRqUq9egrfIjrZ8aEA/VkAtW/t76WgwYYSx5UT037yV2QqUBEvpVDmmUCrmSNG5R3TQ4Ma knFf2ifKlIQDps+DnMoDfifDgCQxesktIa3aX1cnjnDHPKA+iOqea1b2BsqVsFGMj9yjMXS+NEw = X-Google-Smtp-Source: AGHT+IHIrGFrI/VW5C1Oo7epgdOh2bqIGl7erSSD1XInR+mVI7iZoE1DAPlPzvAyyvrurtUNiCXpHg== X-Received: by 2002:a05:600c:1911:b0:43d:526:e0ce with SMTP id 5b1f17b1804b1-43f3a9ab03bmr112004125e9.21.1744710069578; Tue, 15 Apr 2025 02:41:09 -0700 (PDT) Received: from [192.168.0.89] (84.123.232.230.dyn.user.ono.com. [84.123.232.230]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecb8dsm206042145e9.7.2025.04.15.02.41.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Apr 2025 02:41:08 -0700 (PDT) Message-ID: <048f142e-18eb-4416-b7c7-b1398e667b3c@gmail.com> Date: Tue, 15 Apr 2025 11:41:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18885: ERROR: corrupt MVNDistinct entry - 2 To: David Rowley Cc: tharakan@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form , Alexander Korotkov , Tomas Vondra References: <18885-da51324078588253@postgresql.org> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: 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 4/14/25 01:26, David Rowley wrote: > just "continue;". The variable would only be needed if there was some > inner loop and we couldn't use "continue". +1 > * XXX Maybe we should allow searching the expressions even if we > * found an attribute matching the expression? That would handle > * trivial expressions like "(a)" but it seems fairly useless. > */ > Maybe it meant "matching the Var"? +1 I have read your modification of comments to estimate_multivariate_ndistinct. It suggested the idea of letting the GroupVarInfo struct be exported. For now, only add_unique_group_var or another internal selfuncs.c routine may build this list. I'm not sure that the GroupVarInfo abstraction is shaped ideally at the moment, but it seems it may perform duties similar to RestrictInfo but for grouping keys: store the key, cache data about this key, cache statistics and estimations. It would be the first step in letting modules use estimate_multivariate_ndistinct. Likewise, we can use statext_clauselist_selectivity and dependencies_clauselist_selectivity. What do you think about that? P.S. statext_mcv_clauselist_selectivity deserves to be exported, too. -- regards, Andrei Lepikhov