Re: [PATCH] Use optimized single-datum tuplesort in ExecSort

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>, James Coleman <jtc331(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: [PATCH] Use optimized single-datum tuplesort in ExecSort
Date: 2021-07-15 00:30:38
Message-ID: CAEudQApnjQ6VqhGY4SxfmYdNoonSdp_LKHCRaQGJxwFfpLHQrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 14 de jul. de 2021 às 21:21, David Rowley <dgrowleyml(at)gmail(dot)com>
escreveu:

> On Thu, 15 Jul 2021 at 12:10, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >
> > Em qua., 14 de jul. de 2021 às 20:43, David Rowley <dgrowleyml(at)gmail(dot)com>
> escreveu:
> >>
> >> On Thu, 15 Jul 2021 at 05:55, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
> wrote:
> >> > I repeated (3 times) the benchmark with v8 here,
> >> > and the results were not good.
> >>
> >> Do you have any good theories on why the additional branching that's
> >> done in v7b vs v8 might cause it to run faster?
> >
> >
> > Branch Predictions works with *more* probable path,
> > otherwise a penalty occurs and the cpu must revert the results.
>
> But, in v8 there is no additional branch, so no branch to mispredict.
> I don't really see how your explanation fits.
>
In v8 the branch occurs at :
+ if (ExecGetResultType(outerPlanState(sortstate))->natts == 1)

datumSort is tested first.

Cpu time is a more expensive resource.
Always is executed two branches, if it is right path, win,
otherwise occurs a penalty time.

> It seems much more likely to me that the results were just noisy. It
> would be good to see if you can recreate them consistently.
>
I do.
Can you please share results with v7b?

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Schneider 2021-07-15 00:44:34 Re: relation OID in ReorderBufferToastReplace error message
Previous Message David Rowley 2021-07-15 00:20:58 Re: [PATCH] Use optimized single-datum tuplesort in ExecSort