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 1v3Ptj-00Fqq6-CH for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 02:15:23 +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 1v3Pth-005TLU-Dg for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 02:15:22 +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 1v3Pth-005TLM-41 for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 02:15:21 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3Pte-000c9r-1X for pgsql-hackers@postgresql.org; Tue, 30 Sep 2025 02:15:20 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-33255011eafso5320905a91.1 for ; Mon, 29 Sep 2025 19:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759198518; x=1759803318; 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=vHq8PypRBG4/L/zr10DWc+UW9SAsgGayryrPHCdwgDY=; b=e9+chgZbOOdMN35RgFzXCKssOOpikfV80/a5zMOpLHNHoO60G4DpM3+3QWeV25fIe4 cg5/16ew0V4xRf6F2CAolVyMrXv9stcf7cEHfQcasubggQQlQbD9zlhBTL55xP+/vYXK c3ZrrZhMMDbLCNEamawDTll7g0V1NtrcjNc44nG7GuYX0cqNZM+ugXW9zKJ/jsg6ixLn MM3AZwfyWxVpfFbWqGUBqrXIDObSMAksvBZMbb17cvRnLybNJWBpGZXaTq4TFckW+SPk 5wVXTpVPihoSJdl8YTSv+MuTufBWqlvzs2/1samNJar6TH15iWhS7Bfr7KMwFc6y0Qfw d3qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759198518; x=1759803318; 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=vHq8PypRBG4/L/zr10DWc+UW9SAsgGayryrPHCdwgDY=; b=MLGvM2DYSxr+FRhMon3pqRkj7GT5IuDs7mK1xVmsfahUc1QSm8ti1n1SKoAzdZNN41 t0YLA92miLH+hl10wW0kNPwQnz1XI8HCDKU/67TCQmCFMRL+tp3WtLdpqYBWns6WfZUe nIqEoaX6yMbjQp+MEtzm/5pUEXyzml8jlnE2vxIrfcQDZi8O8EqXrp1WknxsvAAJJT12 P3OONukA/MgOL0YV5MEDVSX5B7x/wAQWp7e+OUr6LgGew+q9USa099H1ZpHDGWl1rZa7 +i0P5/dWVodgQwOqoHsDZukGgmJgXtU7WI8TMGbLAzsr9y2wrpY+5Rq5R/3qslOyaQIQ Ev5Q== X-Gm-Message-State: AOJu0YzdnSdFsGN61xT3uXtMF5ER+AOrRj4L3/rXLwGTbfhCb4YCSMRB iTGZ+7mSW7n8j4VMVNtBNySaEhRttBTCD5+FzKgSCe73o4gQrKpz60ScBrqpeTHSOD9SR8P/X9j ib9DN8+I8j4OiZcDdEQF9nCd8/VUhU3w= X-Gm-Gg: ASbGnct1OEom5iAwYBwyMM9k/Te2uEJgeZgbzuZX1zUf9SJBO1zAiTXHgldmKvXnjDp JmJBoTZGtlxOgzdBOgyRHlGhs/U/kQzaYMw2E/MzijIq0bcXv8Tk/sGC+l0IhUmJKO9u7UFFuWD LMIF/MyhPOXDyfaxqlOSX52yBWVybKUx8WdbMQZR4fjCKUxaR+cBHBSMQjzDPhbIOzNlPEwEKTc 2a5roNZFD/0q/Pn1y2RVz2rH9ydbP02td69/C0vp3o= X-Google-Smtp-Source: AGHT+IE61DmOMRgGI9vIEk2bk6eioIFMiCDZYgBCwUuFmZ1IZqyxN1gMkKNC6LXUp8P/bOM5nrANcLmEpRZ5Fjpcm+4= X-Received: by 2002:a17:90b:4b10:b0:32e:37af:b012 with SMTP id 98e67ed59e1d1-3342a13b0b3mr22992135a91.0.1759198518032; Mon, 29 Sep 2025 19:15:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Langote Date: Tue, 30 Sep 2025 11:15:02 +0900 X-Gm-Features: AS18NWBKZyMPE9YktsbLl35QM3KWlwMGH7I83Tp_FEdeh2LqVonQKJlY7cMj4Hk Message-ID: Subject: Re: Batching in executor To: Bruce Momjian 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 Hi Bruce, On Fri, Sep 26, 2025 at 10:49=E2=80=AFPM Bruce Momjian w= rote: > On Fri, Sep 26, 2025 at 10:28:33PM +0900, Amit Langote wrote: > > At PGConf.dev this year we had an unconference session [1] on whether > > the community can support an additional batch executor. The discussion > > there led me to start hacking on $subject. I have also had off-list > > discussions on this topic in recent months with Andres and David, who > > have offered useful thoughts. > > > > This patch series is an early attempt to make executor nodes pass > > around batches of tuples instead of tuple-at-a-time slots. The main > > motivation is to enable expression evaluation in batch form, which can > > substantially reduce per-tuple overhead (mainly from function calls) > > and open the door to further optimizations such as SIMD usage in > > aggregate transition functions. We could even change algorithms of > > some plan nodes to operate on batches when, for example, a child node > > can return batches. > > For background, people might want to watch these two videos from POSETTE > 2025. The first video explains how data warehouse query needs are > different from OLTP needs: > > Building a PostgreSQL data warehouse > https://www.youtube.com/watch?v=3Dtpq4nfEoioE > > and the second one explains the executor optimizations done in PG 18: > > Hacking Postgres Executor For Performance > https://www.youtube.com/watch?v=3DD3Ye9UlcR5Y > > I learned from these two videos that to handle new workloads, I need to > think of the query demands differently, and of course can this be > accomplished without hampering OLTP workloads? Thanks for pointing to those talks -- I gave the second one. :-) Yes, the idea here is to introduce batching without adding much overhead or new code into the OLTP path. --=20 Thanks, Amit Langote