pg_rusage
通过显式重置与输出调用测量当前后端的 CPU 消耗
仓库
ae57c1f3df697fb942f4576f873a655187193ace/pg_rusage
https://github.com/michaelpq/pg_plugins/tree/ae57c1f3df697fb942f4576f873a655187193ace/pg_rusage
源码
pg_plugins-ae57c1f3df69.tar.gz
pg_plugins-ae57c1f3df69.tar.gz
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
pg_rusage | 1.0 | STAT | PostgreSQL | C |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 6230 | pg_rusage | 否 | 是 | 否 | 是 | 否 | 是 | - |
pg_rusage_print() emits the current backend measurement as a WARNING and returns void. No preload; PostgreSQL 14-18 verified in PGSTY builds; upstream declares no major-version matrix.
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0 | 1817161514 | pg_rusage | - |
| RPM | PIGSTY | 1.0 | 1817161514 | pg_rusage_$v | - |
| DEB | PIGSTY | 1.0 | 1817161514 | postgresql-$v-pg-rusage | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0 el8.x86_64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 1.0 el8.aarch64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 1.0 el9.x86_64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 1.0 el9.aarch64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 1.0 el10.x86_64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 1.0 el10.x86_64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 1.0 el10.x86_64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 1.0 el10.x86_64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 1.0 el10.x86_64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 1.0 el10.aarch64.pg18 : pg_rusage_18 pg_rusage_18-1.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 1.0 el10.aarch64.pg17 : pg_rusage_17 pg_rusage_17-1.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 1.0 el10.aarch64.pg16 : pg_rusage_16 pg_rusage_16-1.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 1.0 el10.aarch64.pg15 : pg_rusage_15 pg_rusage_15-1.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 1.0 el10.aarch64.pg14 : pg_rusage_14 pg_rusage_14-1.0-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 1.0 d12.x86_64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 1.0 d12.aarch64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 1.0 d13.x86_64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~trixie_amd64.deb
| PIGSTY 1.0 d13.x86_64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~trixie_amd64.deb
| PIGSTY 1.0 d13.x86_64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~trixie_amd64.deb
| PIGSTY 1.0 d13.x86_64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~trixie_amd64.deb
| PIGSTY 1.0 d13.x86_64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 1.0 d13.aarch64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~trixie_arm64.deb
| PIGSTY 1.0 d13.aarch64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~trixie_arm64.deb
| PIGSTY 1.0 d13.aarch64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~trixie_arm64.deb
| PIGSTY 1.0 d13.aarch64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~trixie_arm64.deb
| PIGSTY 1.0 d13.aarch64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 1.0 u22.x86_64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 1.0 u22.aarch64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 1.0 u24.x86_64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 1.0 u24.aarch64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 1.0 u26.x86_64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~resolute_amd64.deb
| PIGSTY 1.0 u26.x86_64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~resolute_amd64.deb
| PIGSTY 1.0 u26.x86_64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~resolute_amd64.deb
| PIGSTY 1.0 u26.x86_64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~resolute_amd64.deb
| PIGSTY 1.0 u26.x86_64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 1.0 u26.aarch64.pg18 : postgresql-18-pg-rusage postgresql-18-pg-rusage_1.0-1PGSTY~resolute_arm64.deb
| PIGSTY 1.0 u26.aarch64.pg17 : postgresql-17-pg-rusage postgresql-17-pg-rusage_1.0-1PGSTY~resolute_arm64.deb
| PIGSTY 1.0 u26.aarch64.pg16 : postgresql-16-pg-rusage postgresql-16-pg-rusage_1.0-1PGSTY~resolute_arm64.deb
| PIGSTY 1.0 u26.aarch64.pg15 : postgresql-15-pg-rusage postgresql-15-pg-rusage_1.0-1PGSTY~resolute_arm64.deb
| PIGSTY 1.0 u26.aarch64.pg14 : postgresql-14-pg-rusage postgresql-14-pg-rusage_1.0-1PGSTY~resolute_arm64.deb
|
构建
您可以使用 pig build 命令构建 pg_rusage 扩展的 RPM / DEB 包:
安装
您可以直接安装 pg_rusage 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
使用 pig 或者是 apt/yum/dnf 安装扩展:
安装
pig
dnf
apt
创建扩展:
用法
来源:
pg_rusage — 这个模块是一个 PostgreSQL 扩展,可以启用 CPU 测量,包含一个用于启用测量的 SQL 函数和一个用于禁用测量的 SQL 函数。在禁用时,现有的累积结果将会显示出来。在收集或解释相应的 PostgreSQL 统计信息时使用它。请使用上述链接的上游固定版本作为 API 边界,并在目标 PostgreSQL 构建中进行测试。
核心工作流
在目标数据库中安装扩展,当可用时运行上游示例中的最小示例,并在将其集成到应用程序 SQL 中之前验证安装的版本和返回值。
重要对象
pg_rusage_print()是一个扩展函数,返回void。pg_rusage_reset()是一个扩展函数,返回void。
要求与注意事项
- 审查后的控制文件声明默认版本为
1.0。 - 控制文件将扩展标记为可重定位。
- 在生产使用前,请确认权限、支持的 PostgreSQL 版本、升级行为和失败情况,与固定源进行比对。
这个页面对您有帮助吗?
感谢反馈,我们会据此改进这篇文档。
哪里没有解决?(可选)