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 1sm7MY-003NAN-4i for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Sep 2024 07:57:06 +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 1sm7MW-005oDq-ME for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Sep 2024 07:57:05 +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 1sm7MW-005oA2-C4 for pgsql-hackers@lists.postgresql.org; Thu, 05 Sep 2024 07:57:04 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sm7MQ-000Feg-Qy for pgsql-hackers@postgresql.org; Thu, 05 Sep 2024 07:57:04 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-428e0d18666so3089145e9.3 for ; Thu, 05 Sep 2024 00:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725523017; x=1726127817; darn=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=I9TRSAj9ErYUjCyDnRpl/VNDEcOonE/56+Fm0yodYYQ=; b=HVcmA22/xPpXG7Pz/NBcawV6jllwuZiNO6ruJwECqSRXdVcxvg82AaOKNIwRYS8iQe tE6RZviCRbDF3UnXtfke1N1yafpFaFSgc5arUs6uz8rKqacGtuD+81fa9l4/oZoCsS2h xev4kkoH7WVztI99utyBkIPGR/61oNVtHtfgm/gKgDQ1N4ob1qXlW03cSBeVBcdaICXb bb3q/+rUFyqmap5s4EF/JbmcdOuOwgSib9dLMOPPA7plsL47vwLUkM3QpD/xpGPWGV1h WrS9HAoP38q5HNPwhNWJ09CO21qgTR1QYubWzjO0MRFr84Q3OZc7+oXcXHLYIKMVYrg9 p+rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725523017; x=1726127817; 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=I9TRSAj9ErYUjCyDnRpl/VNDEcOonE/56+Fm0yodYYQ=; b=QpmIIHsJHYUMjwnxBNS6ELI6Zyoljo7sjFKSxYtWVWMgcTBPwWFtkVLI/c47Vonorj Ach2EFgwzJCd8wzf06PHCUfS4p3Bicf0Y10ihVZdauUGwHJ1L6m0hL+MHdmXOHb8/P+S 1qYwFAifIRJ4DfT1RiMdzaAhnxuJLVi+Ix1V9wWUWjcSft3xe8XtCc+N2WakuU3qwDF/ 3Ha+8AbaOJWp+k/lqzIL+noETMy6KPCrnLL8J2VnHY9PKglsteVxw05SB5+SaqXs40d0 fGQ6UEPval/hpfhHdSMoMYkV77bfSFF7rwJrDOFGdmag2e41aVHEKQ7c/Ytobo5gFcJx ZkIw== X-Forwarded-Encrypted: i=1; AJvYcCXWKd4jk1C73H+3UeQBuITNqbcuKPHyFowjv9Uwyd+EHS8QV81qRqA0axaaOHUHLRtXPphkxY3DCMnub7Ml@postgresql.org X-Gm-Message-State: AOJu0YwSHRiblZBlIBp7Lqx9QUFEYTuP8+sP+WPx2HjUazuAitmLSs/s /80PNE8GrTLJL3vBlRVhG81xnQd8VQqMj+rIgzOVtHqRa39Glswk X-Google-Smtp-Source: AGHT+IFc4g30JYsMu8RTdz/YJn4yZ+ZTDY/V/oI2ejtRbwAE7WrvUOSxsZFuX93vv6gLvciULQYODA== X-Received: by 2002:a05:600c:3b9f:b0:426:6e8b:3dc5 with SMTP id 5b1f17b1804b1-42bbb440c8bmr157595905e9.32.1725523016958; Thu, 05 Sep 2024 00:56:56 -0700 (PDT) Received: from ?IPV6:2a0c:5a81:4308:2600:b418:1fba:93ae:d98d? ([2a0c:5a81:4308:2600:b418:1fba:93ae:d98d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42c9c3944cesm8625305e9.30.2024.09.05.00.56.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Sep 2024 00:56:56 -0700 (PDT) Message-ID: Date: Thu, 5 Sep 2024 09:56:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Support run-time partition pruning for hash join To: Richard Guo Cc: Alexander Lakhin , David Rowley , Andy Fan , PostgreSQL-development , vignesh C References: <600a153e-191b-952d-7090-cad5097b798f@gmail.com> Content-Language: en-US From: Andrei Lepikhov 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 19/3/2024 07:12, Richard Guo wrote: > > On Tue, Jan 30, 2024 at 10:33 AM Richard Guo > wrote: > > Attached is an updated patch.  Nothing else has changed. > > > Here is another rebase over master so it applies again.  Nothing else > has changed. The patch doesn't apply to the master now. I wonder why this work was suppressed - it looks highly profitable in the case of foreign partitions. And the idea of cost-based enablement makes it a must-have, I think. I have just skimmed through the patch and have a couple of questions: 1. It makes sense to calculate the cost and remember the minimum number of pruned partitions when the cost of HJ with probing is still profitable. Why don't we disable this probing in runtime if we see that the number of potentially pruning partitions is already too low? 2. Maybe I misunderstood the code, but having matched a hashed tuple with a partition, it makes sense for further tuples to reduce the number of probing expressions because we already know that the partition will not be pruned. -- regards, Andrei Lepikhov