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.94.2) (envelope-from ) id 1v3aWc-000iM8-Nk for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 13:36:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v3aWa-00A3wF-Ny for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 13:36:13 +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.94.2) (envelope-from ) id 1v3aWa-00A3w7-ED for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 13:36:13 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3aWY-000ht3-1q for pgsql-hackers@postgresql.org; Tue, 30 Sep 2025 13:36:12 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-b550eff972eso3970344a12.3 for ; Tue, 30 Sep 2025 06:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759239370; x=1759844170; darn=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=T3yCawXxd+oruhFWdSMNVxjqrhnTE8octDCZ/z8Kfog=; b=Bt11PhuoThiqUuBuXr2g/BIge+f3UH8TqmFEBva86EBxILAlfdysxNMeX/TzhYGo9F 46skHRB/smML/V5rVMeyNauD/shSsPz+fyKq21yYbebpliAwKgPZj/ANL3ayNPR9qUCA spF6od8rwbta797qwmldId+88FVDOvv8VBXUOshnEzjhUKjKixdiWPcuAEapzaKDOVEl 64ex9A4tRysMs0aB0J86usuyfivjFEiij2nav/WFkmpfeXJmC5CR2hejJJhQrMxiauC4 MbahEaNNcJ0c92J4+u9wqxshXMmXDYH1Z1lf/7HcPnJnKOvWNsVrdlwE89yLo2k9YRHy 1o4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759239370; x=1759844170; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T3yCawXxd+oruhFWdSMNVxjqrhnTE8octDCZ/z8Kfog=; b=J99+pVrocYBqs+mq7UnzzCP6pEIXs5aV3Ma1tGCprXwAwvoCbu+JL7mXhgDgJZSDJm jGzCs1vZBlrZtLneW5ZwsUUC7hc+GlKduD9RqgyJbyttKSQs1n2lL8Wk8vEgtrSag1pE xCwzdSMYz7AXXI+wHcVNfYlCidiiSmVrfAClithoBJ8gea2Uj4Jb3nvrBWe4FD55pUYB P9WKUtQb7PChjAYXUKsDxlWy2xbMczpU9JP6+ZeXeHDcUfiUh2Viq0bsNshfGjIDgsO3 Xf+Cq+NQfmmsvCIcLeli+HfmgeXj93fNeOdE6LBE22c0bSUwoMi6CO9Sxes+R6XWaZ6x JI+w== X-Gm-Message-State: AOJu0Yw2Qp7D8JlDGSovJYLmaun91P74iq3MbSDP4KQSLNbUTE//FSZH h+rUoDlreuwTJ0kTbH9IGw+x64lh/DZBca0wxZzvpm6H8rRcesHwqHI1Grt4Jy0yWwrhKUbCbnU aYTeM8a/zywFvkeqhApo2MxxIK5VMy+c= X-Gm-Gg: ASbGnctSIkIj6RHs96eAruInAd2vRFyoQVEvoLoXCSCmGdsu+Ws6NEwkVL/GXFKdQXJ YB/b/QGFO9/BlARYc93SLGWJMhTykxn2fu9TGVwfslukJZ8uOJDXw8Hd0PxHnDoztSh40SwyDJz 7v2d3hJBud6nB+sAaT0+v+ejICFoRVUou11dyzgHn2jz5VyKaeUGMaenLjDd82LQvlYwwM6bU0g iWGqy1rTnAaBqgoHahLrv9FzftrTmHIg0qikdh2uXA= X-Google-Smtp-Source: AGHT+IFLlpA3I1AxWke8j8044AYnkNszDyt4UvnGSPOlCD1CjYlftnoy4cC8KzIk1k15rGYAEgv78b9WP8YKosmAFDQ= X-Received: by 2002:a17:90b:3ec9:b0:330:bca5:13d9 with SMTP id 98e67ed59e1d1-3342a2ed8f8mr18146371a91.32.1759239370313; Tue, 30 Sep 2025 06:36:10 -0700 (PDT) MIME-Version: 1.0 References: <68f3771f-91f5-4cb7-b1de-74d9abbf0b96@vondra.me> In-Reply-To: From: Amit Langote Date: Tue, 30 Sep 2025 22:35:52 +0900 X-Gm-Features: AS18NWCw0wa05_5HhyMkNcj_UQi4lnvO8mWE_rhJZwkm28hRwjNqC0bQZTW4MIA Message-ID: Subject: Re: Batching in executor To: Tomas Vondra Cc: PostgreSQL-development 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 On Tue, Sep 30, 2025 at 11:11=E2=80=AFAM Amit Langote wrote: > Hi Tomas, > > Thanks a lot for your comments and benchmarking. > > I plan to reply to your detailed comments and benchmark results For now, I reran a few benchmarks with the master branch as an explicit baseline, since Tomas reported possible regressions with executor_batching=3Doff. I can reproduce that on my side: 5 aggregates, no where: select avg(a), avg(b), avg(c), avg(d), avg(e) from bar; parallel_workers=3D0, jit=3Doff Rows master batching off batching on master vs off master vs= on 1M 47.118 48.545 39.531 +3.0% -16.1% 2M 95.098 97.241 80.189 +2.3% -15.7% 3M 141.821 148.540 122.005 +4.7% -14.0% 4M 188.969 197.056 163.779 +4.3% -13.3% 5M 240.113 245.902 213.645 +2.4% -11.0% 10M 556.738 564.120 486.359 +1.3% -12.6% parallel_workers=3D2, jit=3Don Rows master batching off batching on master vs off master vs= on 1M 21.147 22.278 20.737 +5.3% -1.9% 2M 40.319 41.509 37.851 +3.0% -6.1% 3M 61.582 63.026 55.927 +2.3% -9.2% 4M 96.363 95.245 78.494 -1.2% -18.5% 5M 117.226 117.649 97.968 +0.4% -16.4% 10M 245.503 246.896 196.335 +0.6% -20.0% 1 aggregate, no where: select count(*) from bar; parallel_workers=3D0, jit=3Doff Rows master batching off batching on master vs off master vs= on 1M 17.071 20.135 6.698 +17.9% -60.8% 2M 36.905 41.522 15.188 +12.5% -58.9% 3M 56.094 63.110 23.485 +12.5% -58.1% 4M 74.299 83.912 32.950 +12.9% -55.7% 5M 94.229 108.621 41.338 +15.2% -56.1% 10M 234.425 261.490 117.833 +11.6% -49.7% parallel_workers=3D2, jit=3Don Rows master batching off batching on master vs off master vs= on 1M 8.820 9.832 5.324 +11.5% -39.6% 2M 16.368 18.001 9.526 +10.0% -41.8% 3M 24.810 28.193 14.482 +13.6% -41.6% 4M 34.369 35.741 23.212 +4.0% -32.5% 5M 41.595 45.103 27.918 +8.4% -32.9% 10M 99.494 112.226 94.081 +12.8% -5.4% The regression is more noticeable in the single aggregate case, where more time is spent in scanning. Looking into it. --=20 Thanks, Amit Langote