On 17 March 2018 at 00:47, Tom Lane <t...@sss.pgh.pa.us> wrote: > Amit Khandekar <amitdkhan...@gmail.com> writes: >> If the SELECT target list expression is a join subquery, and if the >> subquery does a hash join, then the query keeps on consuming more and >> more memory. Below is such a query : > > Thanks for the report! > > I dug into this with valgrind, and found that the problem is that > ExecHashTableCreate allocates some memory that isn't freed by > ExecHashTableDestroy, specifically the per-hash-key function > information. This is just dumb. We can keep that stuff in the > hashtable's hashCxt instead, where it will get freed at the right time. > The attached patch seems to fix it just by reordering the code.
I saw that you have now committed the fix and also backported it to all supported branches. Thanks ! -Amit Khandekar EnterpriseDB Corporation The Postgres Database Company