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.92) (envelope-from ) id 1jAIsM-00077e-RI for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2020 19:43: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 1jAIsL-0006Mj-Kw for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2020 19:43: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 1jAIsL-0006Kz-9H for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2020 19:43:13 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jAIsI-0004zg-PC for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2020 19:43:12 +0000 Received: by mail-wm1-x341.google.com with SMTP id e26so3582467wme.5 for ; Fri, 06 Mar 2020 11:43:10 -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=UgMFvOdYYrclaWmEtpnuXsSOuugxXOxd/KJhE0bb2mA=; b=rMhZmx3FSDok1MCYdvTnNNBTDupbFfVhwpKWHycyWpyp3GSpdVnCtP0RsLZencO3Oi EiaIvpS/MqiQoPVm8vuhrsNxaUtRc8l9m7LaErPrz1LA8yvPQ9AbHcYGQMTapcqYPQj7 gkJ5W492PzXkxwG9/HuJcl014H0IZjTW5xZxDZYmyVI/yVO9mmtdER7sN3q9ahOQjDyw DVGN31+YD5MfkpMXbGYc1qEQkNZrzyh17P4Zv1Xcpx+rsdGg5FzQUZZJiBXJ7QTLxJHL OcowDbyYsTVUZzNlK6LXVAMN3XcG08rmeu78NyC5jwCaDy0F3MTqw5QjNrKV0FISd2x2 qwyQ== 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=UgMFvOdYYrclaWmEtpnuXsSOuugxXOxd/KJhE0bb2mA=; b=cF4N6tLMSE9M/9uFXbHOdGe+8GZLi1b7pp/qFipbgX5vzuS764xKCeFMTAJ+2InZff QQZVmWCM7aIzr+KoS6pI0ALanF6Apo1yk71ic8glnRiiv0MKnuxdNqKsouP03VJyaMB1 uq30L0RdiHUFConw7FV9c7U6ZQoRTjuk5FUkt/l53MLOdlkh2O8aXuGehVJz15+GIhTk ZWm1NmrFe1EHcCPEqggGUKB+fVi6XrXOdTH4ZoRX89jX7dvOpIQb8oFF4pvARdcgp/RW 6u6rTHhfhTtcUjWbSEkQVqA2UZck4groGOFLMKd29XtSiNy0j59OQF+hbeoPOiGEiqOk H44g== X-Gm-Message-State: ANhLgQ33+rKTB7FlLaqcHIsAkDG+XW5fiJo79Z/XDAzCgaS5t52vrJhC R9X8pLcZDQJyEHW0AnaLM1vSKg== X-Google-Smtp-Source: ADFU+vtwKoY3UK7ji/HG0W550u8bzEdd+y6Fer7Z+ahgc4ESzehPpjso3TCTl2IQ5RH3lRLU5kGY1Q== X-Received: by 2002:a1c:4c0c:: with SMTP id z12mr5424456wmf.63.1583523789327; Fri, 06 Mar 2020 11:43:09 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id 133sm15560557wmd.5.2020.03.06.11.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 11:43:08 -0800 (PST) Date: Fri, 6 Mar 2020 20:43:07 +0100 From: Tomas Vondra To: Andres Freund Cc: Justin Pryzby , pgsql-hackers@lists.postgresql.org, Jeff Janes Subject: Re: explain HashAggregate to report bucket and memory stats Message-ID: <20200306194307.qeobgf3bklqodecv@development> References: <20200103161925.GM12066@telsasoft.com> <20200203145301.53mozz7gcdaklnjc@alap3.anarazel.de> <20200216000220.GF31889@telsasoft.com> <20200216175307.GJ31889@telsasoft.com> <20200219201037.GA21433@telsasoft.com> <20200222215335.bu4kky7el4nccls5@development> <20200225033532.GX31889@telsasoft.com> <20200301154540.GL29456@telsasoft.com> <20200306175859.d56ohskarwldyrrw@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200306175859.d56ohskarwldyrrw@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Mar 06, 2020 at 09:58:59AM -0800, Andres Freund wrote: > ... > >> + } >> + else if (!inst->nbuckets) >> + ; /* Do nothing */ >> + else >> + { >> + if (inst->nbuckets_original != inst->nbuckets) >> + { >> + ExplainIndentText(es); >> + appendStringInfo(es->str, >> + "Buckets: %ld (originally %ld)", >> + inst->nbuckets, >> + inst->nbuckets_original); >> + } >> + else >> + { >> + ExplainIndentText(es); >> + appendStringInfo(es->str, >> + "Buckets: %ld", >> + inst->nbuckets); >> + } >> + >> + if (es->analyze) >> + appendStringInfo(es->str, >> + " Memory Usage: hashtable: %ldkB, tuples: %ldkB", >> + spacePeakKb_hash, spacePeakKb_tuples); >> + appendStringInfoChar(es->str, '\n'); > >I'm not sure I like the alternative output formats here. All the other >fields are separated with a comma, but the original size is in >parens. I'd probably just format it as "Buckets: %lld " and then add >", Original Buckets: %lld" when differing. > FWIW this copies hashjoin precedent, which does this: appendStringInfo(es->str, "Buckets: %d (originally %d) Batches: %d (originally %d) Memory Usage: %ldkB\n", hinstrument.nbuckets, ... I agree it's not ideal, but maybe let's not invent new ways to format the same type of info. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services