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 1t1Ldt-00Fqxi-2u for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Oct 2024 08:13:57 +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 1t1Lcs-0010eN-S6 for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Oct 2024 08:12:55 +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 1t1Lcs-0010eE-J5 for pgsql-bugs@lists.postgresql.org; Thu, 17 Oct 2024 08:12:54 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t1Lcq-001V4s-Jy for pgsql-bugs@lists.postgresql.org; Thu, 17 Oct 2024 08:12:54 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-71e52582d0bso482464b3a.3 for ; Thu, 17 Oct 2024 01:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729152770; x=1729757570; 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=/8ehNHiif6Sx2kKT8AQ2jDN/pYrFtH8/hOqwI+hQdFc=; b=IX1nLPHMWUIWrl2EWN2y+DKOIOMmqIGPFa/7u/muk8TkiN2MDm3Z2r2vz0yG6Umlzs K4iwKq5afsao1nTBnfovZtNuBG8t3v7KuQ7eaF/i3LXFb68OWQb60yvkrfjph+eYztIW 3jq1gKUH3pQB5iXBjyhM2DPQK/m8rW8boaKzC8iRV36xJgtQNwExnfGbqo6pN/+xZijh a9uGfqf+29jLQquWx/HnX47oYKD2jcGIjYiWIYj8NMirlbqlePRqzUVXdl5N6542KeWx /v3ZUwmtoMLiMPZdGO0IaIhp5te+2exPtOvEus2Oklsy1DESzcVmJonIErjby3Hdc50h mNUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729152770; x=1729757570; 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=/8ehNHiif6Sx2kKT8AQ2jDN/pYrFtH8/hOqwI+hQdFc=; b=NbMUbPSrvPOk1pwLFFO9JhRYXl+IAG42km7tsrQDF6eT5YKAn8G1TyiQv5dR5QZMg1 lpZS24ORi9Cj8zrzFPC6PTV/FQtNyOJBNpINrA5ciBf9d2RAImlACghpxpqA5Te3iXRo F5bKgedcYKPmaBne6mR1oExxypWEjv+KMSkGwXr/dq1Kwd1O1aHXT6B70Z8dIAH3Xi00 EfZIJWWfGsVsoEkycwk+Lo5YCtt3KNX0WNzyUxswXW+xb5Ktx8pwysznuGD0oKeQOY97 Kc6qpNSqhJFYveXnBES7p9ZvBq+jR5I6QB35Pu4W3KVcg1Zw5JXuSbYMv77Ja+XhcxQu URkg== X-Forwarded-Encrypted: i=1; AJvYcCWEoAET9+w7tNtpfuqCBFLZv9cwvsDljB3XgZRlW6v+3gkCHu6NGddONXPWN4sCtwV4/Zh6BwD6LfZF@lists.postgresql.org X-Gm-Message-State: AOJu0Yx3cnKGm+0T3/2ebe6N9rY0L4ucXZ1verEnn93S9FdTODFKF08y 34VqbYmPKHJR6gMD2QXRle3okp2ns3GPWfdEqgeBNMTAMrJu3zx6ti0joITiQhI= X-Google-Smtp-Source: AGHT+IEthx6NHiIKYdN+r+QNl02fHkGV1oJbVVIP3iVxezFtDvFTvdsKAZX0N3jL8NOOh4287CSBCA== X-Received: by 2002:a05:6a00:2e11:b0:71e:c0c:5996 with SMTP id d2e1a72fcca58-71e4c1512ccmr29867243b3a.7.1729152770060; Thu, 17 Oct 2024 01:12:50 -0700 (PDT) Received: from [10.10.20.104] (node-u1e.pool-101-109.dynamic.totinternet.net. [101.109.152.18]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e774cb6c8sm4275266b3a.161.2024.10.17.01.12.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Oct 2024 01:12:49 -0700 (PDT) Message-ID: <30fbb76b-4b6f-405e-bf9c-741fe2c7722a@gmail.com> Date: Thu, 17 Oct 2024 15:12:45 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Reference to - BUG #18349: ERROR: invalid DSA memory alloc request size 1811939328, CONTEXT: parallel worker To: Thomas Munro Cc: Tom Lane , Craig Milhiser , pgsql-bugs@lists.postgresql.org References: <6785e9e8-4c64-41b0-9e72-c13d1822b599@gmail.com> <0c3b0e1b-55d1-42b6-8c3c-4392479187db@gmail.com> <3581840.1728887169@sss.pgh.pa.us> <3a1ac6f1-ac30-4ed4-8d0d-beb8a5aca7e5@gmail.com> Content-Language: en-AU 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 10/16/24 16:19, Thomas Munro wrote: > On Mon, Oct 14, 2024 at 10:16 PM Andrei Lepikhov wrote: >> See the attachment for a sketch of the solution. > > Thanks Andrei, I mostly agree with your analysis, but I came up with a > slightly different patch. I think we should check for extreme skew if > old_batch->space_exhausted (the parent partition). Your sketch always > does it for batch 0, which works for these examples but I don't think > it's strictly correct: if batch 0 didn't run out of memory, it might > falsely report extreme skew just because it had (say) 0 or 1 tuples. Yeah, I misunderstood the meaning of the estimated_size variable. Your solution is more universal. Also, I confirm, it passes my synthetic test. Also, it raises the immediate question: What if we have too many duplicates? Sometimes, in user complaints, I see examples where they, analysing the database's logical consistency, pass through millions of duplicates to find an unexpected value. Do we need a top memory consumption limit here? I recall a thread in the mailing list with a general approach to limiting backend memory consumption, but it is finished with no result. The patch looks good as well as commentary. -- regards, Andrei Lepikhov