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 1uthHh-00Cpi9-Qn for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Sep 2025 06:47:59 +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 1uthHh-007aLZ-3Y for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Sep 2025 06:47:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uthHg-007aKT-Kf for pgsql-hackers@lists.postgresql.org; Wed, 03 Sep 2025 06:47:57 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uthHb-000Iv4-33 for pgsql-hackers@postgresql.org; Wed, 03 Sep 2025 06:47:56 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-24af8cd99ddso26241495ad.0 for ; Tue, 02 Sep 2025 23:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1756882070; x=1757486870; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:date:to:from :subject:message-id:from:to:cc:subject:date:message-id:reply-to; bh=phaglxFscSB80Khvi8NTcDJLoxf6mPDCH9MDlEp2e5E=; b=rlYWH7mG5jCTjDPHj0zWhTAIrnpzFchsWSJqpuZRDAuMAXKnJ5fGiJYRf2gdd1QLlP xM2ioJD/I+e1P0JZMDLOuVAme9fYuybLOlhZBRVD8AgUINSCmTQoIvpSnhpoYmyPe1vI j3Mw97hMCPxvq0cdJR1iZWICvobSZzGYP7nsPckqUJwscNbJX1ShNXdzaHTd2I73s/B1 4Zv8m7LPjKKeU75EE13AxqGdREmGmdWZobrjyhd0g7ycNEtJYUxQUIthdpPFTm3Up5os 5nGrccwKzQqMzMXrfMkG/3caLBo500einZeXB6TbW18FcQGvz3nyios7VYcstAR16GLE kavA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756882070; x=1757486870; h=mime-version:user-agent:content-transfer-encoding:date:to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=phaglxFscSB80Khvi8NTcDJLoxf6mPDCH9MDlEp2e5E=; b=mSUA8jiim63Q96yomjMaXVmStvPTGwcqdm/yZ3pXMVB6Bwd0ljElWxgulCE8ooXEbk KriYkFggzaC7FcpdWWls/4HMLB4vC08RnI64PSRTUMrbPGPHjevEaPoewU+QJ/NaHYy0 rms9RQ8OAM2NM+vRXqHr3v1qdRoeWCp1Fg4A+qv+seFAWX06+ZzOzOl7L1JhLQ09k+TA omADAzezvrw0Nkzn5UJ2SKdfrVckiClRPE/PeyVaDThkk69OjBlTMoEQcXeoteDb00zG 5fuOytGU1pgQZ+hzfqOCQBbwji3VE1TNXn7wFlyUbcvKH33VcLcBGZfPnFRZ6AoddQ/M OH7A== X-Gm-Message-State: AOJu0YyXe0EqL/n2vGKygH4T0ioMJEsE7jYRVpajjDpH2iRXqnLtBDJx 4kry+bMoJibkloLp0pjNAkLzsc+N7RbU9iclLTM99SLGV4QyyqL/Ag1y2+k+y8v7Pz1E+ebW8Jj YosQ= X-Gm-Gg: ASbGncuIjjd+NDYRpGPX0XDxTEpeOkeXRI+1ZIXTz8TMjsnba/8oioeJTG9i5cpQgiD EdOekc2Dj9AGIDT/DzZP/7BS59pC94U1yuC2hscm83FXhZ//Q/JqZYf7jIFv1oFcE6sLHl1f7g6 qW7ktFylqiTsQzCbX2v9mfXw85Q5VHCDB/LyEW7Bjwg+blgAZeg0Em6o4V8a2zngWSUslVKQ+/y IZFQ9WVicA859PYMjp2xWoizK6MmaYMnWSz1qQnY80NX9fZ/DL2lcaWp40Zi5DgbvwVrVg3xZZS MdXBhfb42/NA6qvpekxAMYSaiV37ITPuShzO2aGyRHJihFyqyWnJaE9iOhU3ggW2RiESPiPsNyS Fb6vepl5967HtAUcBCHWtgX7qYukHhlGMzVLbk4Leis80nY/ovcTCgyMPTDMZjYA5m+OKftkvJa hLA7U= X-Google-Smtp-Source: AGHT+IHgQ29A6UCgdJ0qxwi8rg1HNB+qQBzGV0wZFlAmpflkghAMmx1R+XNcj+62MURe8I7ouZT3fQ== X-Received: by 2002:a17:903:28c:b0:245:f2c2:64ed with SMTP id d9443c01a7336-24944a742f8mr178236945ad.24.1756882069453; Tue, 02 Sep 2025 23:47:49 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77248cfbc9esm10723787b3a.99.2025.09.02.23.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 23:47:49 -0700 (PDT) Message-ID: Subject: Should io_method=worker remain the default? From: Jeff Davis To: pgsql-hackers@postgresql.org Date: Tue, 02 Sep 2025 23:47:48 -0700 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Has there already been a discussion about leaving the default as io_method=3Dworker? There was an Open Item for this, which was closed as "Won't Fix", but the links don't explain why as far as I can see. I tested a concurrent scan-heavy workload (see below) where the data fits in memory, and "worker" seems to be 30% slower than "sync" with default settings. I'm not suggesting that AIO overall is slow -- on the contrary, I'm excited about AIO. But if it regresses in some cases, we should make a conscious choice about the default and what kind of tuning advice needs to be offered. I briefly tried tuning to see if a different io_workers value would solve the problem, but no luck. The good news is that io_uring seemed to solve the problem. Unfortunately, that's platform-specific, so it can't be the default. I didn't dig in very much, but it seemed to be at least as good as "sync" mode for this workload. Regards, Jeff Davis Test summary: 32 connections each perform repeated sequential scans. Each connection scans a different 1GB partition of the same table. I used partitioning and a predicate to make it easier to script in pgbench. Test details: Machine: AMD Ryzen 9 9950X 16-Core Processor 64GB RAM Local storage, NVMe SSD Ubuntu 24.04 (Linux 6.11, liburing 2.5) Note: the storage didn't matter much, because the data fits in memory. To get consistent results, when changing between data directories for the 17 and 18 tests, I had to drop the filesystem cache first to make room, then run a few scans to warm it with the data from the right data directory. For simplicity I disabled parallel query, but that didn't seem to have a big effect. Everything else was set to the default. Setup (checksums enabled): =3D> create table t(sid int8, c0 int8, c1 int8, c2 int8, c3 int8, c4 int8, c5 int8, c6 int8, c7 int8) partition by range (sid); $ (for i in `seq 0 31`; do echo "create table t$(printf "%02d" $i) partition of t for values from ($i) to ($((i+1)));"; done) | ./bin/psql postgres $ (for i in `seq 0 31`; do=C2=A0 echo "insert into t$(printf "%02d" $i) select $i, 0, 1, 2, 3, 4, 5, 6, 7 from generate_series(0, 10000000);"; done) | ./bin/psql postgres =3D> vacuum analyze; checkpoint; Script count.sql: SELECT COUNT(*) FROM t WHERE sid=3D:client_id; pgbench: ./bin/pgbench --dbname=3Dpostgres -M prepared -n -c 32 -T 60 \ -f count.sql Results: PG17: tps =3D 36.209048 PG18 (io_method=3Dsync) tps =3D 34.014890 PG18 (io_method=3Dworker io_workers=3D3) tps =3D 23.938509 PG18 (io_method=3Dworker io_workers=3D16) tps =3D 16.734360 PG18 (io_method=3Dio_uring) tps =3D 35.546825