Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icBdq-0005bg-Ke for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Dec 2019 17:07:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1icBdp-0005dh-2m for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Dec 2019 17:07:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icBdo-0005da-Nv for pgsql-bugs@lists.postgresql.org; Tue, 03 Dec 2019 17:07:12 +0000 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1icBdm-0007Qp-4f for pgsql-bugs@lists.postgresql.org; Tue, 03 Dec 2019 17:07:11 +0000 Received: by mail-qv1-xf41.google.com with SMTP id y8so1822285qvk.6 for ; Tue, 03 Dec 2019 09:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=SZv/KL+WHRNV/yTTbwuNpBX7JlQtHFf9Ftpbb3evMJw=; b=njKNHv9avv3sJmeexeUJOc4G7XxAxkdvgJ/n64zjhvii1L81u1wnwQTzAwDdELUArE /e+DwTPuyXyUEOqx/bTUp1gZ2H90dkuVm2MSuvVRw8iywUqyMFQtZWejP8OTLjCMToFl xV1THfkzhH84bP1pTS+0f77mFICSiTsqxAEW1UxX/3v5YVyWQjd64kwvj49hkgyhk858 2kHW3L32wbqeqr1AWsBLVDn5UL2+M5JBY15QT0XJficN+eL7mLaUF6nhDhoZUJy6wkmg FxfGRipXdh/KNlA89aVQhH36uhp/3f3gtQfpTmTsJlWczJ4X765bNPPm9zfN3TSUHNUz CUUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=SZv/KL+WHRNV/yTTbwuNpBX7JlQtHFf9Ftpbb3evMJw=; b=EAnRLvKBLjNQTneSStpWHOWSqs0qeaiNMZ3JHrO9Ntf85kR2y3voJeAfkHMqDDXXXs dpexIede/nUAF9mc2EPbBDcgU5WovV7uyFFFHcNxbKHqSFjvnhvwyRcnHUtTDHZmL252 8fHsqB+2zM3fcpL25WEPWmVINtLd+kQ9hzX8Vg/L19O0q9fckY7Qdy/hkC0Qu7Qa7fxs 4KzpXf5wB8JsBxp17NKG5iDsklNFOIQszBPMw+34y47ZVm4pKBsNgLrIyHm38CBDEl1f 8BURpnsx+xckt8ZX/vH61oOaOuOpmauTmCEfO1ge1xhu5gPyyH984/BzfwQSIsteTmsn luJA== X-Gm-Message-State: APjAAAUx6laccrVN3tYHcOqNqVWNfAKPKteEhT+FHT8Z8unKC+bzhrEr ojJwUfL+BVQ3fS+AOQZEyDoKHg== X-Google-Smtp-Source: APXvYqw0uVFzM6fBl3tQS41k/+xFtA+BzbVzrqohCVk8HUxBgjYq6mBg90wqx47T3HY/U+0b3WgmHg== X-Received: by 2002:a0c:be82:: with SMTP id n2mr6173337qvi.70.1575392828527; Tue, 03 Dec 2019 09:07:08 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id p35sm2044115qtd.12.2019.12.03.09.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:07:07 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id DB239300803; Tue, 3 Dec 2019 14:07:04 -0300 (-03) Date: Tue, 3 Dec 2019 14:07:04 -0300 From: Alvaro Herrera To: Thomas Munro Cc: Andres Freund , Tomas Vondra , James Coleman , PostgreSQL mailing lists Subject: Re: BUG #16104: Invalid DSA Memory Alloc Request in Parallel Hash Message-ID: <20191203170704.GA28076@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello I can make no useful comment on the correctness of the new bit distribution. But I can make two comments on this part: On 2019-Nov-21, Thomas Munro wrote: > So here's a draft steal-the-bucket-bits patch. Yeah, > reverse_bits_u32() may be in the wrong header. I think pg_bitutils.h is the right place in master, but that file didn't exist earlier. I think access/hash.h is the right place in older branches, which is where hash_any() used to be. > But is it too slow? > On my desktop I can call ExecGetBucketAndBatch() 353 million times per > second (~2.8ns), and unpatched gets me 656 million/sec (~1.5ns) > (though that includes a function call, and when Hash does it it's > inlined), but it's only slower when nbatch > 1 due to the condition. If the whole query takes hours (or even minutes) to run, then adding one second of runtime is not going to change things in any noticeable way. I'd rather have the extreme cases working and take additional 1.3ns per output row, than not work at all. > To put that number into persepective, I can hash 10 million single-int > tuples from a prewarmed seq scan in 2.5s without batching or > parallelism, so that's 250ns per tuple. This'd be +0.4% of that, and > I do see it in a few more samples with my profiler, but it's still > basically nothing, and lost in the noise with other noisy partitioning > overheads like IO. Thoughts? That summarizes it well for me: yes, it's a slowdown, yes it's barely measurable. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services