Hi,

On Tue, 10 Mar 2026 at 16:23, Xuneng Zhou <[email protected]> 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


Reply via email to