Make EXPLAIN report maximum hashtable usage across multiple rescans.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 969f9d0b4ba574bb8df65683dbf7a09c030f3e67
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2020-04-11T16:39:19Z
Releases: 13.0
Make EXPLAIN report maximum hashtable usage across multiple rescans.

Before discarding the old hash table in ExecReScanHashJoin, capture
its statistics, ensuring that we report the maximum hashtable size
across repeated rescans of the hash input relation.  We can repurpose
the existing code for reporting hashtable size in parallel workers
to help with this, making the patch pretty small.  This also ensures
that if rescans happen within parallel workers, we get the correct
maximums across all instances.

Konstantin Knizhnik and Tom Lane, per diagnosis by Thomas Munro
of a trouble report from Alvaro Herrera.

Discussion: https://postgr.es/m/20200323165059.GA24950@alvherre.pgsql

Files

Discussion