From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Richard Guo <guofenglinux(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: weird hash plan cost, starting with pg10 |
Date: | 2020-04-27 16:18:23 |
Message-ID: | 20200427161823.GY28974@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Apr 10, 2020 at 04:11:27PM -0400, Tom Lane wrote:
> I'm not sure it's worth any risk though. A much simpler
> fix is to make sure we clear the dangling hashtable pointer, as in
> 0002 below (a simplified form of Konstantin's patch). The net
> effect of that is that in the case where a hash table is destroyed
> and never rebuilt, EXPLAIN ANALYZE would report no hash stats,
> rather than possibly-garbage stats like it does today. That's
> probably good enough, because it should be an uncommon corner case.
>
> Thoughts?
Checking if you're planning to backpatch this ?
> diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
> index c901a80..9e28ddd 100644
> --- a/src/backend/executor/nodeHashjoin.c
> +++ b/src/backend/executor/nodeHashjoin.c
> @@ -1336,6 +1336,12 @@ ExecReScanHashJoin(HashJoinState *node)
> else
> {
> /* must destroy and rebuild hash table */
> + HashState *hashNode = castNode(HashState, innerPlanState(node));
> +
> + /* for safety, be sure to clear child plan node's pointer too */
> + Assert(hashNode->hashtable == node->hj_HashTable);
> + hashNode->hashtable = NULL;
> +
> ExecHashTableDestroy(node->hj_HashTable);
> node->hj_HashTable = NULL;
> node->hj_JoinState = HJ_BUILD_HASHTABLE;
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2020-04-27 16:24:06 | Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators |
Previous Message | Justin Pryzby | 2020-04-27 15:02:08 | Re: doc review for v13 |