Re: explain HashAggregate to report bucket and memory stats

2020-07-23 Thread Daniel Gustafsson
> On 12 Jul 2020, at 21:52, Daniel Gustafsson wrote: > This thread has stalled and the patch has been Waiting on Author since March, > and skimming the thread there seems to be questions raised over the value > proposition. Is there progress happening behind the scenes or should we close > this

Re: explain HashAggregate to report bucket and memory stats

2020-07-12 Thread Daniel Gustafsson
> On 9 Apr 2020, at 00:24, Jeff Davis wrote: > > On Wed, 2020-04-08 at 16:00 -0500, Justin Pryzby wrote: >> 90% of the initial goal of this patch was handled by instrumentation >> added by >> "hash spill to disk" (1f39bce02), but this *also* adds: >> >> - separate accounting for tuples vs hashta

Re: explain HashAggregate to report bucket and memory stats

2020-04-08 Thread Jeff Davis
On Wed, 2020-04-08 at 16:00 -0500, Justin Pryzby wrote: > 90% of the initial goal of this patch was handled by instrumentation > added by > "hash spill to disk" (1f39bce02), but this *also* adds: > > - separate accounting for tuples vs hashtable; > - number of hash buckets; > - handles other ag

Re: explain HashAggregate to report bucket and memory stats

2020-04-08 Thread Justin Pryzby
On Fri, Mar 20, 2020 at 03:44:42AM -0500, Justin Pryzby wrote: > On Fri, Mar 13, 2020 at 10:57:43AM -0700, Andres Freund wrote: > > On 2020-03-13 10:53:17 -0700, Jeff Davis wrote: > > > On Fri, 2020-03-13 at 10:27 -0700, Andres Freund wrote: > > > > On 2020-03-13 10:15:46 -0700, Jeff Davis wrote: >

Re: explain HashAggregate to report bucket and memory stats

2020-03-20 Thread Justin Pryzby
On Fri, Mar 13, 2020 at 10:57:43AM -0700, Andres Freund wrote: > On 2020-03-13 10:53:17 -0700, Jeff Davis wrote: > > On Fri, 2020-03-13 at 10:27 -0700, Andres Freund wrote: > > > On 2020-03-13 10:15:46 -0700, Jeff Davis wrote: > > > > Also, is there a reason you report two different memory values >

Re: explain HashAggregate to report bucket and memory stats

2020-03-13 Thread Andres Freund
Hi, On 2020-03-13 10:53:17 -0700, Jeff Davis wrote: > On Fri, 2020-03-13 at 10:27 -0700, Andres Freund wrote: > > On 2020-03-13 10:15:46 -0700, Jeff Davis wrote: > > > Also, is there a reason you report two different memory values > > > (hashtable and tuples)? I don't object, but it seems like a l

Re: explain HashAggregate to report bucket and memory stats

2020-03-13 Thread Jeff Davis
On Fri, 2020-03-13 at 10:27 -0700, Andres Freund wrote: > On 2020-03-13 10:15:46 -0700, Jeff Davis wrote: > > Also, is there a reason you report two different memory values > > (hashtable and tuples)? I don't object, but it seems like a little > > too > > much detail. > > Seems useful to me - the

Re: explain HashAggregate to report bucket and memory stats

2020-03-13 Thread Andres Freund
Hi, On 2020-03-13 10:15:46 -0700, Jeff Davis wrote: > Also, is there a reason you report two different memory values > (hashtable and tuples)? I don't object, but it seems like a little too > much detail. Seems useful to me - the hashtable is pre-allocated based on estimates, whereas the tuples a

Re: explain HashAggregate to report bucket and memory stats

2020-03-13 Thread Jeff Davis
+ /* hashtable->entrysize includes additionalsize */ + hashtable->instrument.space_peak_hash = Max( + hashtable->instrument.space_peak_hash, + hashtable->hashtab->size * sizeof(TupleHashEntryData)); + + hashtabl

Re: explain HashAggregate to report bucket and memory stats

2020-03-09 Thread Andres Freund
Hi, On 2020-03-06 15:33:10 -0600, Justin Pryzby wrote: > On Fri, Mar 06, 2020 at 09:58:59AM -0800, Andres Freund wrote: > > > + ExplainIndentText(es); > > > + appendStringInfo(es->str, > > > + "Buckets: %ld (originally %ld)",

Re: explain HashAggregate to report bucket and memory stats

2020-03-06 Thread Justin Pryzby
On Fri, Mar 06, 2020 at 09:58:59AM -0800, Andres Freund wrote: > > + ExplainIndentText(es); > > + appendStringInfo(es->str, > > + "Buckets: %ld (originally %ld)", > > + inst->nbuc

Re: explain HashAggregate to report bucket and memory stats

2020-03-06 Thread Tomas Vondra
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)

Re: explain HashAggregate to report bucket and memory stats

2020-03-06 Thread Andres Freund
Hi, On 2020-03-01 09:45:40 -0600, Justin Pryzby wrote: > +/* > + * Show hash bucket stats and (optionally) memory. > + */ > +static void > +show_tuplehash_info(HashTableInstrumentation *inst, ExplainState *es) > +{ > + longspacePeakKb_tuples = (inst->space_peak_tuples + 1023) / 1024, > +

Re: explain HashAggregate to report bucket and memory stats

2020-03-01 Thread Justin Pryzby
Updated for new tests in 58c47ccfff20b8c125903482725c1dbfd30beade and rebased. >From 3e1904c6c36ee3ff4f56a2808c2400a3b2d2a0e5 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Tue, 31 Dec 2019 18:49:41 -0600 Subject: [PATCH v6 1/7] explain to show tuplehash bucket and memory stats.. Note that ha

Re: explain HashAggregate to report bucket and memory stats

2020-02-24 Thread Justin Pryzby
On Sat, Feb 22, 2020 at 10:53:35PM +0100, Tomas Vondra wrote: > 1) explain.c API > > The functions in explain.c (even the static ones) follow the convention > that the last parameter is (ExplainState *es). I think we should stick > to this, so the new parameters should be added before it. I found

Re: explain HashAggregate to report bucket and memory stats

2020-02-22 Thread Justin Pryzby
On Sat, Feb 22, 2020 at 10:53:35PM +0100, Tomas Vondra wrote: > I've started looking at this patch, because I've been long missing the Thanks for looking I have brief, initial comments before I revisit the patch. > 3) Almost all executor nodes that are modified to include this new > instrumentat

Re: explain HashAggregate to report bucket and memory stats

2020-02-22 Thread Tomas Vondra
Hi, I've started looking at this patch, because I've been long missing the information about hashagg hash table, so I'm pleased someone is working on this. In general I agree it may be useful to add simila information to other nodes using a hashtable, but IMHO the hashagg bit is the most useful,

Re: explain HashAggregate to report bucket and memory stats

2020-02-19 Thread Justin Pryzby
On Sun, Feb 16, 2020 at 11:53:07AM -0600, Justin Pryzby wrote: > Updated: > > . remove from explain analyze those tests which would display sort >Memory/Disk. Oops. . Rebased on top of 5b618e1f48aecc66e3a9f60289491da520faae19 . Updated to avoid sort's Disk output, for real this time. . A

Re: explain HashAggregate to report bucket and memory stats

2020-02-16 Thread Justin Pryzby
Updated: . remove from explain analyze those tests which would display sort Memory/Disk. Oops. . fix issue with the first patch showing zero "tuples" memory for some grouping sets. . reclassify memory as "tuples" if it has to do with "members". So hashtable size is now redundant with

Re: explain HashAggregate to report bucket and memory stats

2020-02-15 Thread Justin Pryzby
On Mon, Feb 03, 2020 at 06:53:01AM -0800, Andres Freund wrote: > On 2020-01-03 10:19:26 -0600, Justin Pryzby wrote: > > On Sun, Feb 17, 2019 at 11:29:56AM -0500, Jeff Janes wrote: > > https://www.postgresql.org/message-id/CAMkU%3D1zBJNVo2DGYBgLJqpu8fyjCE_ys%2Bmsr6pOEoiwA7y5jrA%40mail.gmail.com > >

Re: explain HashAggregate to report bucket and memory stats

2020-02-03 Thread Andres Freund
Hi, On 2020-01-03 10:19:26 -0600, Justin Pryzby wrote: > On Sun, Feb 17, 2019 at 11:29:56AM -0500, Jeff Janes wrote: > https://www.postgresql.org/message-id/CAMkU%3D1zBJNVo2DGYBgLJqpu8fyjCE_ys%2Bmsr6pOEoiwA7y5jrA%40mail.gmail.com > > What would I find very useful is [...] if the HashAggregate nod

Re: explain HashAggregate to report bucket and memory stats

2020-01-26 Thread Justin Pryzby
On Sun, Jan 26, 2020 at 08:14:25AM -0600, Justin Pryzby wrote: > On Fri, Jan 03, 2020 at 10:19:25AM -0600, Justin Pryzby wrote: > > On Sun, Feb 17, 2019 at 11:29:56AM -0500, Jeff Janes wrote: > > https://www.postgresql.org/message-id/CAMkU%3D1zBJNVo2DGYBgLJqpu8fyjCE_ys%2Bmsr6pOEoiwA7y5jrA%40mail.gm

Re: explain HashAggregate to report bucket and memory stats

2020-01-26 Thread Justin Pryzby
On Fri, Jan 03, 2020 at 10:19:25AM -0600, Justin Pryzby wrote: > On Sun, Feb 17, 2019 at 11:29:56AM -0500, Jeff Janes wrote: > https://www.postgresql.org/message-id/CAMkU%3D1zBJNVo2DGYBgLJqpu8fyjCE_ys%2Bmsr6pOEoiwA7y5jrA%40mail.gmail.com > > What would I find very useful is [...] if the HashAggrega

explain HashAggregate to report bucket and memory stats

2020-01-03 Thread Justin Pryzby
On Sun, Feb 17, 2019 at 11:29:56AM -0500, Jeff Janes wrote: https://www.postgresql.org/message-id/CAMkU%3D1zBJNVo2DGYBgLJqpu8fyjCE_ys%2Bmsr6pOEoiwA7y5jrA%40mail.gmail.com > What would I find very useful is [...] if the HashAggregate node under > "explain analyze" would report memory and bucket stat