Re: Streamify more code paths - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: Streamify more code paths
Date
Msg-id CAN55FZ3u_PSXX26pXJi8mo1-ykezV1L=GuFhfrGq73TCASeuyA@mail.gmail.com
Whole thread Raw
In response to Re: Streamify more code paths  (Xuneng Zhou <xunengzhou@gmail.com>)
Responses Re: Streamify more code paths
List pgsql-hackers
Hi,

On Tue, 10 Mar 2026 at 16:23, Xuneng Zhou <xunengzhou@gmail.com> wrote:
>
> Another code path that showed significant performance improvement is
> pgstatindex [1]. I've incorporated the test into the script too. Here
> are the results from my testing:
>
> method=worker io-workers=12
> pgstatindex_large          base=   233.8ms  patch=    54.1ms   4.32x
> ( 76.8%)  (reads=27460→1757, io_time=213.94→6.31ms)
>
> method=io_uring
> pgstatindex_large          base=   224.2ms  patch=    56.4ms   3.98x
> ( 74.9%)  (reads=27460→1757, io_time=204.41→4.88ms)

I didn't run the benchmark yet but here is a small suggestion for the
pgstatindex patch:

+    p.current_blocknum = BTREE_METAPAGE + 1;
+    p.last_exclusive = nblocks;

     for (blkno = 1; blkno < nblocks; blkno++)

...

+    p.current_blocknum = HASH_METAPAGE + 1;
+    p.last_exclusive = nblocks;

     for (blkno = 1; blkno < nblocks; blkno++)

Could you move 'BTREE_METAPAGE + 1' and 'HASH_METAPAGE + 1' into
variables and then set p.current_blocknum and blkno using those
variables? p.current_blocknum and blkno should have the same initial
values, this change makes code less error prone and easier to read in
my opinion.

Other than the comment above, LGTM.

--
Regards,
Nazir Bilal Yavuz
Microsoft



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: SQL Property Graph Queries (SQL/PGQ)
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Patch for migration of the pg_commit_ts directory