From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Cory Tucker <cory.tucker@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Query Using Massive Temp Space
Date: Tue, 21 Nov 2017 17:37:23 -0500
Message-ID: <4346.1511303843@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEepm=3e9RKr3DCv0=nGWiNTPs7_SqfqLt=pc83M03kN0KuBkA@mail.gmail.com>
References: <CAG_=8kBoWY4AXwW=Cj44xe13VZnYohV9Yr-_hvZdx2xpiipr9w@mail.gmail.com>
<16625.1511199408@sss.pgh.pa.us>
<CAG_=8kAd9PLv1f=P2beqw2dXT7jVti20siyqjbZF1RzsCWUv7g@mail.gmail.com>
<12076.1511287447@sss.pgh.pa.us>
<CAEepm=3e9RKr3DCv0=nGWiNTPs7_SqfqLt=pc83M03kN0KuBkA@mail.gmail.com>
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Wed, Nov 22, 2017 at 7:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Now, there's definitely something busted here; it should not have gone as
>> far as 2 million batches before giving up on splitting.
> I had been meaning to discuss this. We only give up when we reach the
> point when a batch is entirely entirely kept or sent to a new batch
> (ie splitting the batch resulted in one batch with the whole contents
> and another empty batch). If you have about 2 million evenly
> distributed keys and an ideal hash function, and then you also have 42
> billion keys that are the same (and exceed work_mem), we won't detect
> extreme skew until the 2 million well behaved keys have been spread so
> thin that the 42 billion keys are isolated in a batch on their own,
> which we should expect to happen somewhere around 2 million batches.
Yeah, I suspected it was something like that, but hadn't dug into the
code yet.
> I have wondered if our extreme skew detector needs to go off sooner.
> I don't have a specific suggestion, but it could just be something
> like 'you threw out or kept more than X% of the tuples'.
Doing this, with some threshold like 95% or 99%, sounds plausible to me.
I'd like to reproduce Cory's disk-space issue before we monkey with
related logic, though; fixing the part we understand might obscure
the part we still don't.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, cory.tucker@gmail.com
Subject: Re: [GENERAL] Query Using Massive Temp Space
In-Reply-To: <4346.1511303843@sss.pgh.pa.us>
References: <CAG_=8kBoWY4AXwW=Cj44xe13VZnYohV9Yr-_hvZdx2xpiipr9w@mail.gmail.com> <16625.1511199408@sss.pgh.pa.us> <CAG_=8kAd9PLv1f=P2beqw2dXT7jVti20siyqjbZF1RzsCWUv7g@mail.gmail.com> <12076.1511287447@sss.pgh.pa.us> <CAEepm=3e9RKr3DCv0=nGWiNTPs7_SqfqLt=pc83M03kN0KuBkA@mail.gmail.com> <4346.1511303843@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox