Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0Wht-001yoT-0h for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 03:27:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0Whq-00D3Wg-25 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 03:27:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0Whq-00D3WX-12 for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 03:27:26 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0Who-00000001i6U-2sPK for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 03:27:25 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-b95c0fc928bso83063066b.0 for ; Wed, 11 Mar 2026 20:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773286042; cv=none; d=google.com; s=arc-20240605; b=CzR1pRSOJG1dO3SyFti9cK3MCxIAA6HKgNdETKdoNdCLOBowqGomidv/ul0zbI+GQe gHOd9UXUkApS8QhUEDzSOmEMqocXkRgjmrVTfyT+Cqh7stL0dKuIZMqZ974U2aOW9fiE P6lUy6Fa3sbBeigFQh5XkD41W8k/p6WamP5jNk4qxBc6zjz9qbU2aca+IZjAR8u6Adya 1BncCJ1S3UxxpWnTaua1uaBEi8M8Ww/P0gOiNcW4NIvPHgV8GIjIQrNSLm7Ha4SIQS1F kTZqhl8LbEsPx4dQAp1D55SN6ITth9vroe2LZ1BmhexW2oygTBgOlBAdAWsjtthFj6Q2 5Yzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wohoYKtoD8nkyuaJW/dXRGGbN5zcGvosY24Yrw5w5Ko=; fh=P7kjyNfymrvHmr2HLyvtJGhZhyi01uXFl5YoofvQ01A=; b=DU/sB/WdUzK7N52hXfM9924Ghi4Lw4r7gFf5ZnA1fVdT8yBkkG+sus3yOfH9MKQ+sN Bq2sh2jY7jyf4HiHjEW9zt+uTd7Q0BpO0djyevoY9VNwhK7EV5atM+z0JmRpb4A5S94s Udfv9+4KezR2jhAws+ZLm6vNEvDeuShCbC1YLYTBA7dlqDhYrqUeuvB/U7uY9F3qBOt5 ua7vTtkaX3SH/a/SkHzxw2Zwly1fjjvcy9a7dPOVVtBgTcDA3KL1Csnz1zxFVq0wnTfS wSOcvLJGuatowIcNLSccWr9eCczYnW8iLOETaFDq0+tGiDcOxNjowvmJx3H7q3sFYCxA X8iw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773286042; x=1773890842; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wohoYKtoD8nkyuaJW/dXRGGbN5zcGvosY24Yrw5w5Ko=; b=NUGQd52mXkI2Se/gws8Gygybd+RJOs+V1fmh1sf1eEKp8vCUNho7VcXsBC74Ox/yMU v6p2Do+meY3+rkbwwDGosE75Lx80Op4Afr7ptqPc5W8AZEgvUxTklBsVH5diHbPN7pq8 IJlxVd+g3fK+Vc1BlrKSmEsNnxYDshKHhE0ABBt8IOxSQdsaueUg4C26C0QIqiipICOn rEDpHPSmkqkev1wdhAJVldV+SelskBl1B7SoF31UzKAWxcsc3Qpd/cFM2Obq7Ij1gUxi PQwpU/jXNgxThUFxm3jb8+BFInNU8vGHU4biVZW7Nd77JVYWaCChx58ymRn64D2lrexb elww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773286042; x=1773890842; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wohoYKtoD8nkyuaJW/dXRGGbN5zcGvosY24Yrw5w5Ko=; b=iJNOtCQwC5X+KbEGJ69xWVtZ+Rj5AzCv26F+/sZQ9MRs+CeeL/TG8PEKxKxhB3b8uT CHL4kWU+HPrid+ZOvE+tEVpSxzevmtYQaofTyLQNHGK2vyTyNU4eIItqULE5N9V3NVTA GLP2j1KHTsBOsjMeqIR+O+lyNpVcQ4o3yS8rJhOTsdtot1N8IYF7zQnzZemV5cbqmnH7 h18tskMOixA9U+9C1vkmdxX5CVCSdDqOexItqkbdv2YCY0ZUdXeNbjSDtO0Be07J9r3t RSnUk4OFuGzrL3zNiGyfvFSW+uemWmtcAcZU0LGRIInAwyEWAUc/sZU+1Kmp/vTfQpTB 1BMA== X-Forwarded-Encrypted: i=1; AJvYcCUUol8dm5VQlkcN+MbbZzLEPgQDUDSzKl8mE5AunaWtvAxowXLoqHwDanwyR2MfnMSokC3HXgDpDR0g/od2@lists.postgresql.org X-Gm-Message-State: AOJu0YxGauZ9PJhqg9BH1YBV30CQ0LnxTX1QALaJLoymw87x9/ZxP7IZ vumVVvUfQgEAEEVPXZCya7maFMlo0iZmDBglJKQgDECMmDpuRiofgsiE+HTrRX7syQOQPvG1WYD TKZRkE4s7cBIf+HS2B3N2HgAeb7BKQeo= X-Gm-Gg: ATEYQzya9zhQ8QMeIG1xcr9ZpB/b0vtNJOm5XApFQWtCuydUpraSDHt7A1xFmBUnBtt 4PvD4T3REPqxAvpTsDyflcFimjEFU0/AYOITlmd5se/6kscsiJX4WVu1vMUGh8qe/Gy+q7jiMfj 9J/y6X/pNyvv+H1BP/Ofq0JLC2cyfQ6fjoDaBXgJqrkCPDFkZFW2SOB4jD6egOEBtKqppJ3ZCV4 7TMPAvggJQIgNwy8JVzckPcU5cU8kOVCbsr66545c/3jfgkANUhi3Ef3M3Q7bgsNqKZFbVXPs+B ZaFRzwcD5LS2J9sD/KaW6hKi4SMZk/clYqqrR/ZKDChUY7oF9Imex3FCfn3v2ddYe7SoSYQzfAG HKPM43iy5 X-Received: by 2002:a17:907:3d4c:b0:b87:b0ba:5d2d with SMTP id a640c23a62f3a-b972e63a866mr285077666b.57.1773286041762; Wed, 11 Mar 2026 20:27:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Xuneng Zhou Date: Thu, 12 Mar 2026 11:27:10 +0800 X-Gm-Features: AaiRm52wFARMvYK3fP4dPqceme_BbSJnTpvGVDA2LBQpe0QSe_rIXsYQw_PXbYo Message-ID: Subject: Re: Streamify more code paths To: Nazir Bilal Yavuz Cc: Michael Paquier , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Mar 11, 2026 at 3:53=E2=80=AFPM Nazir Bilal Yavuz wrote: > > Hi, > > On Tue, 10 Mar 2026 at 16:23, Xuneng Zhou 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=3Dworker io-workers=3D12 > > pgstatindex_large base=3D 233.8ms patch=3D 54.1ms 4.32= x > > ( 76.8%) (reads=3D27460=E2=86=921757, io_time=3D213.94=E2=86=926.31ms) > > > > method=3Dio_uring > > pgstatindex_large base=3D 224.2ms patch=3D 56.4ms 3.98= x > > ( 74.9%) (reads=3D27460=E2=86=921757, io_time=3D204.41=E2=86=924.88ms) > > I didn't run the benchmark yet but here is a small suggestion for the > pgstatindex patch: > > + p.current_blocknum =3D BTREE_METAPAGE + 1; > + p.last_exclusive =3D nblocks; > > for (blkno =3D 1; blkno < nblocks; blkno++) > > ... > > + p.current_blocknum =3D HASH_METAPAGE + 1; > + p.last_exclusive =3D nblocks; > > for (blkno =3D 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. > Thanks! That makes sense to me. Please see the patch I=E2=80=99ll post late= r. --=20 Best, Xuneng