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 1iemKJ-0002oj-3w for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2019 20:41:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iemKG-00074J-Ih for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2019 20:41:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iemKG-00074B-An for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2019 20:41:44 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iemK8-0002Qa-QQ for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2019 20:41:43 +0000 Received: by mail-wm1-x343.google.com with SMTP id f129so4702774wmf.2 for ; Tue, 10 Dec 2019 12:41:36 -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:references:mime-version :content-disposition:in-reply-to; bh=L0dfapOoPpFpxRr+M9olmGORi+PPBmVSDkhlkl0yRuI=; b=u3dxo70HFURkbH3NRVg1w4m/acfz8YRT92XGAgq+dgtD4013uN5XQbNbfnmZL8hwqw 4EDdUCwF3vX1dgBy7TF2lG8cKxJZxU56CQVE92i8u85KJb/koJErDHogkIyeGUh77Mul z2r9ykpYyPDH0uNQQ2aJ0lVA0TERiTKc4otQ0qclSX/mWRhQF1SxwnxMBKj5Ig26A1ZD 0fv7jG0LzCX3Coxfr1LZUk3EessZhOxZouc6yn/YtdXHGQzH2d9iWQLKVrLzv3YoH7n0 uspTLwccaNK5usCOhWVte3J+LSgH/juZawc1jjkuj0p4JQVxG7GmRomuL5jk73/hYzvI fJZQ== 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:references :mime-version:content-disposition:in-reply-to; bh=L0dfapOoPpFpxRr+M9olmGORi+PPBmVSDkhlkl0yRuI=; b=I+VsYsfkTBokuXYq6CWIBWgtoHcl6pShnwfEtpKLBC/mJICtlrLtnm1hoV/H9Y+L+1 aEhL+w4w20WpjuZx3tu8qy1yApzOjT1e8Rtu9zXI1AW2+Fi2MsXnpAxTnawkj5bqVhVr hI/4yUA6NNi3Xo4t7snySYoakx2VIGky0qdq9Piy6SypIwfeUP3W88lUUReAzCicd8Nt ttkdpnrihuPXnnZ3nVJheR1/DjEYwwfm7hQgoqNdVek/h5tbsgotK3zWphLQqIExwmKA irD3ERXQADqHgyzT3ek83GjUhrYUSMliyce7jEWvQ9hYizk5y0afinf62MlQA3kLDNy4 nkhA== X-Gm-Message-State: APjAAAWu9mvUHz3I0S+cB7fUHF1bL0cRnGcw4LEicblfL1yrPurS7xjB FnoCtqzQdExu6tzR2RBKo0f2XQ== X-Google-Smtp-Source: APXvYqy50xtpDEAKNWJI63h2JZTW72zqTnK5VDw3dC5cbmdPsdN0tjgPurZmC29HKki7jCkiHnNRsg== X-Received: by 2002:a1c:a382:: with SMTP id m124mr7384745wme.90.1576010494878; Tue, 10 Dec 2019 12:41:34 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id a64sm4638181wmc.18.2019.12.10.12.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 12:41:33 -0800 (PST) Date: Tue, 10 Dec 2019 21:41:32 +0100 From: Tomas Vondra To: Tom Lane Cc: Alvaro Herrera , Thomas Munro , Andres Freund , James Coleman , PostgreSQL mailing lists Subject: Re: BUG #16104: Invalid DSA Memory Alloc Request in Parallel Hash Message-ID: <20191210204132.wyb7bt6pi7konmnh@development> References: <20191203170704.GA28076@alvherre.pgsql> <20191210173224.y5vaam6ep7pjmddt@development> <8525.1576007382@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <8525.1576007382@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Dec 10, 2019 at 02:49:42PM -0500, Tom Lane wrote: >Tomas Vondra writes: >> As for the performance impact, I did this: > >> create table dim (id int, val text); >> insert into dim select i, md5(i::text) from generate_series(1,1000000) s(i); >> create table fact (id int, val text); >> insert into fact select mod(i,1000000)+1, md5(i::text) from generate_series(1,25000000) s(i); >> set max_parallel_workers_per_gather = 0; >> select count(*) from fact join dim using (id); > >> So a perfectly regular join between 1M and 25M table. On my machine, >> this takes ~8851ms on master and 8979ms with the patch (average of about >> 20 runs with minimal variability). That's ~1.4% regression, so a bit >> more than the 0.4% mentioned before. Not a huge difference though, and >> some of it might be due to different binary layout etc. > >Hmm ... I replicated this experiment here, using my usual precautions >to get more-or-less-reproducible numbers [1]. I concur that the >patch seems to be slower, but only by around half a percent on the >median numbers, which is much less than the run-to-run variation. > Sounds good. >So that would be fine --- except that in my first set of runs, >I forgot the "set max_parallel_workers_per_gather" step and hence >tested this same data set with a parallel hash join. And in that >scenario, I got a repeatable slowdown of around 7.5%, which is far >above the noise floor. So that's not good --- why does this change >make PHJ worse? > Hmmm, I can't reproduce this. For me the timings from 20 runs look like this: master | patched workers=2 workers=5 | workers=2 workers=5 -------------------------|-------------------------- 3153 1785 | 3185 1790 3167 1783 | 3220 1783 I haven't done the extra steps with cpupower/taskset, but the numbers seem pretty consistent. I'll try on another machine tomorrow. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services