Re: explain HashAggregate to report bucket and memory stats

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: explain HashAggregate to report bucket and memory stats
Дата
Msg-id f95260dc8cd3b5a4de85d9f89b5bae19dfbc4c13.camel@j-davis.com
обсуждение исходный текст
Ответ на Re: explain HashAggregate to report bucket and memory stats  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: explain HashAggregate to report bucket and memory stats  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
+        /* hashtable->entrysize includes additionalsize */
+        hashtable->instrument.space_peak_hash = Max(
+            hashtable->instrument.space_peak_hash,
+            hashtable->hashtab->size *
sizeof(TupleHashEntryData));
+
+        hashtable->instrument.space_peak_tuples = Max(
+            hashtable->instrument.space_peak_tuples,
+                hashtable->hashtab->members *
hashtable->entrysize);

I think, in general, we should avoid estimates/projections for
reporting and try to get at a real number, like
MemoryContextMemAllocated(). (Aside: I may want to tweak exactly what
that function reports so that it doesn't count the unused portion of
the last block.)

For instance, the report is still not accurate, because it doesn't
account for pass-by-ref transition state values.

To use memory-context-based reporting, it's hard to make the stats a
part of the tuple hash table, because the tuple hash table doesn't own
the memory contexts (they are passed in). It's also hard to make it
per-hashtable (e.g. for grouping sets), unless we put each grouping set
in its own memory context.

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.

Regards,
    Jeff Davis





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: shared-memory based stats collector
Следующее
От: James Coleman
Дата:
Сообщение: Re: [PATCH] Incremental sort (was: PoC: Partial sort)