io_method
是一个 配置参数,用于选择执行异步 I/O 的方法。
io_method
在 PostgreSQL 18 中添加。
默认
io_method
的默认值为:worker
。
用法
io_method
可设置为以下值之一:
worker
sync
io_uring
如果选择 worker
,I/O 工作进程的数量通过 io_workers
控制。
请注意,只有当 PostgreSQL 在构建时使用了 --with-liburing
/ -Dliburing
选项时,才能选择 io_uring
。
按 PostgreSQL 版本详细信息
io_method (PostgreSQL 19)
设置 | worker |
单位 | |
类别 | 资源使用 / I/O |
简短描述 | 选择执行异步 I/O 的方法。 |
扩展描述 | |
上下文 | postmaster |
变量类型 | enum |
来源 | 默认 |
最小值 | |
最大值 | |
枚举值 | sync, worker |
启动值 | worker |
重置值 | worker |
源文件 | |
源行 | |
需要重启 | false |
文档:io_method
io_method (PostgreSQL 18)
设置 | worker |
单位 | |
类别 | 资源使用 / I/O |
简短描述 | 选择执行异步 I/O 的方法。 |
扩展描述 | |
上下文 | postmaster |
变量类型 | enum |
来源 | 默认 |
最小值 | |
最大值 | |
枚举值 | sync, worker |
启动值 | worker |
重置值 | worker |
源文件 | |
源行 | |
需要重启 | false |
文档:io_method
变更历史
- PostgreSQL 18
- 已添加(提交 da722699)
示例
尝试将 io_method
设置为 io_uring
,而服务器在构建时未支持此功能。
postgres=# ALTER SYSTEM SET io_method = 'io_uring'; ERROR: invalid value for parameter "io_method": "io_uring" HINT: Available values: sync, worker.
参考资料
- PostgreSQL 文档: io_method
有用链接
- 是时候测试 io_method (用于 Postgres 18) 了 - 2025 年 5 月 Tomas Vondra 的博客