Re: Optimize WindowAgg's use of tuplestores

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, David Rowley <dgrowley(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Optimize WindowAgg's use of tuplestores
Date: 2024-07-18 07:55:42
Message-ID: 87ed7r5e2p.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> writes:

> On Fri, Jul 12, 2024 at 11:59 AM Ashutosh Bapat
> <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>>
>>
> Out of curiosity, I measured the performance with just the "unlikely"
> change and with the full patch. Below are the results
> Testing with 1000000 partitions
...
> latency average = 333.538 ms
>
> with just unlikely change
> Testing with 1000000 partitions
..
> Testing with 1 partitions
>
> There's noticeable change across all the number of partitions with
> just "unlikely" change.

I'm curious about why a 'unlikey' change can cause noticeable change,
especially there is just one function call in the 'if-statement' (I am
thinking more instrucments in the if-statement body, more changes it can
cause).

+ if (unlikely(winstate->buffer == NULL))
+ prepare_tuplestore(winstate);

--
Best Regards
Andy Fan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-07-18 07:57:23 Re: optimizing pg_upgrade's once-in-each-database steps
Previous Message Daniel Gustafsson 2024-07-18 07:37:06 Re: Internal error codes triggered by tests