Re: Optimize WindowAgg's use of tuplestores - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Optimize WindowAgg's use of tuplestores
Date
Msg-id CAExHW5umW6im2aw-S0nWguqZjdUbOMXZhN7N=g=HNGSsQs5_7A@mail.gmail.com
Whole thread Raw
In response to Re: Optimize WindowAgg's use of tuplestores  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
List pgsql-hackers
On Fri, Jul 12, 2024 at 11:59 AM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
>
> Now that you are also seeing the slowdown with your earlier patch, I
> am wondering whether adding unlikely() by itself is a good
> optimization. There might be some other reason behind the perceived
> slowdown. How do the numbers look when you just add unlikely() without
> any other changes?

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 = 503.321 ms
latency average = 510.365 ms
latency average = 512.117 ms
Testing with 100000 partitions
latency average = 371.764 ms
latency average = 361.202 ms
latency average = 360.529 ms
Testing with 10000 partitions
latency average = 327.495 ms
latency average = 327.334 ms
latency average = 325.925 ms
Testing with 1000 partitions
latency average = 319.290 ms
latency average = 318.709 ms
latency average = 318.013 ms
Testing with 100 partitions
latency average = 317.756 ms
latency average = 318.933 ms
latency average = 316.529 ms
Testing with 10 partitions
latency average = 316.392 ms
latency average = 315.297 ms
latency average = 316.007 ms
Testing with 1 partitions
latency average = 330.978 ms
latency average = 330.529 ms
latency average = 333.538 ms

with just unlikely change
Testing with 1000000 partitions
latency average = 504.786 ms
latency average = 507.557 ms
latency average = 508.522 ms
Testing with 100000 partitions
latency average = 316.345 ms
latency average = 315.496 ms
latency average = 326.503 ms
Testing with 10000 partitions
latency average = 296.878 ms
latency average = 293.927 ms
latency average = 294.654 ms
Testing with 1000 partitions
latency average = 292.680 ms
latency average = 283.245 ms
latency average = 280.857 ms
Testing with 100 partitions
latency average = 292.569 ms
latency average = 296.330 ms
latency average = 295.389 ms
Testing with 10 partitions
latency average = 285.909 ms
latency average = 287.499 ms
latency average = 293.322 ms
Testing with 1 partitions
latency average = 305.080 ms
latency average = 309.100 ms
latency average = 307.794 ms

There's noticeable change across all the number of partitions with
just "unlikely" change. The improvement is lesser with larger number
of partitions but quite visible with lesser number of partitions.

full patch
Testing with 1000000 partitions
latency average = 356.026 ms
latency average = 375.280 ms
latency average = 374.575 ms
Testing with 100000 partitions
latency average = 318.173 ms
latency average = 307.598 ms
latency average = 315.868 ms
Testing with 10000 partitions
latency average = 295.541 ms
latency average = 313.317 ms
latency average = 299.936 ms
Testing with 1000 partitions
latency average = 295.082 ms
latency average = 305.204 ms
latency average = 294.702 ms
Testing with 100 partitions
latency average = 302.552 ms
latency average = 307.596 ms
latency average = 304.202 ms
Testing with 10 partitions
latency average = 295.050 ms
latency average = 291.127 ms
latency average = 299.704 ms
Testing with 1 partitions
latency average = 308.781 ms
latency average = 304.071 ms
latency average = 319.560 ms

There is significant improvement with a large number of partitions as
seen previously. But for a smaller number of partitions the
performance worsens, which needs some investigation.
--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Junwang Zhao
Date:
Subject: Support specify tablespace for each merged/split partition
Next
From: Andrei Lepikhov
Date:
Subject: Re: Removing unneeded self joins