Re: Avoiding hash join batch explosions with extreme skew and weird stats

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jesse Zhang <sbjesse(at)gmail(dot)com>, dkimura(at)pivotal(dot)io, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, david(dot)g(dot)kimura(at)gmail(dot)com
Subject: Re: Avoiding hash join batch explosions with extreme skew and weird stats
Date: 2020-05-28 02:25:50
Message-ID: CAAKRu_b0kGNbUy-8-D2BJ54kSd4Hpd_dyeJtc+sChCgCGJQS+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've attached a rebased patch which includes the "provisionally detach"
deadlock hazard fix approach as well as addresses some of the following
feedback from Jeff Davis provided off-list:

> Can you add some high-level comments that describe the algorithm and
> what the terms mean?

I added to the large comment at the top of nodeHashjoin.c. I've also
added comments to a few of the new members in some structs. Plus I've
added some in-line comments to assist the reviewer that may or may not
be overkill in a final version.

> Can you add some comments to describe what's happening when a batch is
> entering fallback mode?
...
> Can you add some comments describing tuple relocation?
...
> Can you describe somewhere what all the bits for outer matches are for?
All three done.

Also, we kept the batch 0 spilling patch David Kimura authored [1]
separate so it could be discussed separately because we still had some
questions.
It would be great to discuss those, however, keeping them separate might
be more confusing -- I'm not sure.

[1]
https://www.postgresql.org/message-id/CAHnPFjQiYN83NjQ4KvjX19Wti%3D%3Duzyw8D24va56zJKzOt%2BB51A%40mail.gmail.com

Attachment Content-Type Size
v8-0001-Implement-Adaptive-Hashjoin.patch application/octet-stream 141.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2020-05-28 04:35:39 Re: Getting ERROR with FOR UPDATE/SHARE for partitioned table.
Previous Message David G. Johnston 2020-05-28 01:33:16 Re: Explain Analyze (Rollback off) Suggestion