Re: [PATCH] Incremental sort (was: PoC: Partial sort)

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: James Coleman <jtc331(at)gmail(dot)com>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, Shaun Thomas <shaun(dot)thomas(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Date: 2019-06-24 20:20:10
Message-ID: 20190624202010.7n7lolmrcs67udcg@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 24, 2019 at 07:05:24PM +0100, Simon Riggs wrote:
>On Mon, 24 Jun 2019 at 18:01, James Coleman <jtc331(at)gmail(dot)com> wrote:
>
>> On Mon, Jun 24, 2019 at 12:56 PM Simon Riggs <simon(at)2ndquadrant(dot)com>
>> wrote:
>>
>> > What is the specific use case for this? This sounds quite general case.
>>
>> They are both general cases in some sense, but the concerns lie mostly
>> with what happens when they're unexpectedly encountered. For example,
>> if the expected row count or group size is off by a good bit and we
>> effectively have to perform a sort of all (or most) possible rows.
>>
>> If we can get the performance to a point where that misestimated row
>> count or group size doesn't much matter, then ISTM including the patch
>> becomes a much more obvious total win.
>>
>
>I was trying to think of ways of using external information/circumstance to
>knowingly avoid negative use cases. i.e. don't treat sort as a black box,
>use its context.
>

Like what, for example? I'm not saying there's no such additional
information, but I can't think of anything at the moment.

One of the issues is that while the decision whether to use incremental
sort is done during planning, most of the additional (and reliable)
infomation about the data is only available at execution time. And it's
likely not available explicitly - we need to deduce it. Which I think is
exactly what the min group size heuristics is about, no?

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-06-24 20:58:34 Re: Update list of combining characters
Previous Message Tomas Vondra 2019-06-24 20:16:01 Re: [PATCH] Incremental sort (was: PoC: Partial sort)