Re: Hash join in SELECT target list expression keeps consuming memory - Mailing list pgsql-hackers

From Amit Khandekar
Subject Re: Hash join in SELECT target list expression keeps consuming memory
Date
Msg-id CAJ3gD9coxPJUwGPXAjHHCyjKg=JRcqkh3hTvzJPoLis1-dkX6Q@mail.gmail.com
Whole thread Raw
In response to Re: Hash join in SELECT target list expression keeps consuming memory  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Hash join in SELECT target list expression keeps consuming memory  (Jaime Soler <jaime.soler@gmail.com>)
List pgsql-hackers
On 17 March 2018 at 00:47, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Amit Khandekar <amitdkhan.pg@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


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Online enabling of checksums
Next
From: Michael Paquier
Date:
Subject: Re: file cloning in pg_upgrade and CREATE DATABASE