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 1iyvfN-0007HH-6u for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2020 10:42:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyvfK-0004Oi-8A for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Feb 2020 10:42:46 +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 1iyvfJ-0004Oa-Rc for pgsql-hackers@lists.postgresql.org; Tue, 04 Feb 2020 10:42:46 +0000 Received: from mx0b-00296801.pphosted.com ([148.163.153.148]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyvfC-0001bc-3Q for pgsql-hackers@postgresql.org; Tue, 04 Feb 2020 10:42:43 +0000 Received: from pps.filterd (m0114586.ppops.net [127.0.0.1]) by mx0b-00296801.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 014AXJXP024263 for ; Tue, 4 Feb 2020 10:42:36 GMT Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0b-00296801.pphosted.com with ESMTP id 2xw2rkjcte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 04 Feb 2020 10:42:36 +0000 Received: by mail-pf1-f200.google.com with SMTP id r13so11197070pfr.17 for ; Tue, 04 Feb 2020 02:42:36 -0800 (PST) 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=+/JUarqeXTCKujIpH6mj2fPcLH96qIQhdvxkcVW3xEg=; b=XjwMncCdrmrgYcRPVVD8HyOptc/BrCbB6hgnzKoi9EWHy4nIWME4O5+BuY5hfeiVV8 syLgBhLeVv3RVfGwUxscIYXA7TeWds3o8rhXZymyDotz10VSgKvvqi6NdKBRpuddc4PU hKfrBvbPtpMRY+1c4kE0l88LwF7l5RAFdzA5SxnIQ6VB3F+G3H0wJ3iZQiqYHVAtHgqj pnLfkZYhK3WJT4yO3RmAl7W77jLHLb9/OlfTzUnc1AtzfZw/qqcxfn9lz+VmURr2Vq73 DkfOJ80W30zCM71pHEakA39AON2o3PJLB3dtRxkopAPMVljSaB+Tj7noeEswKhmkUJ1P 7Pjg== X-Gm-Message-State: APjAAAWAjzRHNvNJYaLHhJ/HKk8PJpE9m5NtpyBI2kyobL/pnUvGgL5z e+fbYLetgNpZcmPc9koVaAapuKT8va3AuGerYpz5NCzcJXNYwpE4U4fROKPNVvkr4I4cyi810M/ uHtdIirlSHl4r4/8DJSUKANbSZn+vdiD6h0ayZ0ZEZxljnYmr7Q== X-Received: by 2002:a17:902:9309:: with SMTP id bc9mr30003076plb.88.1580812955354; Tue, 04 Feb 2020 02:42:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzY0VS8JjSH7Fl9q3bgJ1gh+5/rmrnPm2nLiAyUDxw/qKvyzg+hNA4b/4gGofYTXw1UOEZn3A== X-Received: by 2002:a17:902:9309:: with SMTP id bc9mr30003055plb.88.1580812955058; Tue, 04 Feb 2020 02:42:35 -0800 (PST) Received: from localhost (li1619-9.members.linode.com. [172.104.39.9]) by smtp.gmail.com with ESMTPSA id l13sm2857483pjq.23.2020.02.04.02.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 02:42:34 -0800 (PST) Date: Tue, 4 Feb 2020 18:42:29 +0800 From: Adam Lee To: Jeff Davis Cc: Peter Geoghegan , Heikki Linnakangas , Tomas Vondra , Taylor Vesely , Melanie Plageman , PostgreSQL Hackers Subject: Re: Memory-Bounded Hash Aggregation Message-ID: <20200204104229.GA58298@earth.local> References: <20191214173225.3kzsbncr6brpxdll@development> <775d754c-9a61-5363-6998-f87d15f1b592@iki.fi> <6e2b4a4475a690fa515829950aeed935696b0df3.camel@j-davis.com> <97c46a59c27f3c38e486ca170fcbc618d97ab049.camel@j-davis.com> <8bf8d5f77db49cc1f032b6c7c0cfe0d6da89d64a.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8bf8d5f77db49cc1f032b6c7c0cfe0d6da89d64a.camel@j-davis.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-04_02:2020-02-04,2020-02-04 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=5 priorityscore=1501 phishscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=701 spamscore=0 clxscore=1011 malwarescore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002040079 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Feb 03, 2020 at 06:24:14PM -0800, Jeff Davis wrote: > On Mon, 2020-02-03 at 10:29 -0800, Jeff Davis wrote: > > I ended up converting the freelist to a min heap. > > > > Attached is a patch which makes three changes to better support > > HashAgg: > > And now I'm attaching another version of the main Hash Aggregation > patch to be applied on top of the logtape.c patch. > > Not a lot of changes from the last version; mostly some cleanup and > rebasing. But it's faster now with the logtape.c changes. Nice! Just back from the holiday. I had the perf test with Tomas's script, didn't notice the freelist sorting regression at that time. The minheap looks good, have you tested the performance and aggregate validation? About the "Cap the size of the LogicalTapeSet's freelist" and "Don't bother tracking free space for HashAgg at all" you mentioned in last mail, I suppose these two options will lost the disk space saving benefit since some blocks are not reusable then? -- Adam Lee