跳转到主要内容

pg_upless

检测表上的无用UPDATE

pg_upless · 检测表上的无用UPDATE

概览

ID扩展软件包版本类别许可证编程语言
5180pg_uplesspg_upless0.0.3ADMINPostgreSQLSQL
属性可执行文件动态库需要预加载需要建扩展可迁移可信
----dt-否否否是否是

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY0.0.319 18 17 16 15pg_uplessplpgsql
RPMPIGSTY0.0.319 18 17 16 15pg_upless_$v-
DEBPIGSTY0.0.319 18 17 16 15postgresql-$v-pg-upless-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
el8.aarch64N/APIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
el9.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
el9.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
el10.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
el10.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
d12.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
d12.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
d13.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
d13.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u22.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u22.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u24.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u24.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u26.x86_64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
u26.aarch64PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3PIGSTY 0.0.3
软件包版本平台仓库大小下载
pg_upless_190.0.3el9.x86_64pigsty11.5 KiBpg_upless_19-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_190.0.3el9.aarch64pigsty11.5 KiBpg_upless_19-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_190.0.3el10.x86_64pigsty11.6 KiBpg_upless_19-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_190.0.3el10.aarch64pigsty11.6 KiBpg_upless_19-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-19-pg-upless0.0.3d12.x86_64pigsty5.2 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-19-pg-upless0.0.3d12.aarch64pigsty5.2 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-19-pg-upless0.0.3d13.x86_64pigsty5.2 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-19-pg-upless0.0.3d13.aarch64pigsty5.2 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-19-pg-upless0.0.3u22.x86_64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-19-pg-upless0.0.3u22.aarch64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-19-pg-upless0.0.3u24.x86_64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-19-pg-upless0.0.3u24.aarch64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-19-pg-upless0.0.3u26.x86_64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-19-pg-upless0.0.3u26.aarch64pigsty4.9 KiBpostgresql-19-pg-upless_0.0.3-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_upless_180.0.3el8.x86_64pigsty11.5 KiBpg_upless_18-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_180.0.3el8.aarch64pigsty11.5 KiBpg_upless_18-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_180.0.3el9.x86_64pigsty11.5 KiBpg_upless_18-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_180.0.3el9.aarch64pigsty11.5 KiBpg_upless_18-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_180.0.3el10.x86_64pigsty11.6 KiBpg_upless_18-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_180.0.3el10.aarch64pigsty11.6 KiBpg_upless_18-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-18-pg-upless0.0.3d12.x86_64pigsty5.2 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-18-pg-upless0.0.3d12.aarch64pigsty5.2 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-18-pg-upless0.0.3d13.x86_64pigsty5.2 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-18-pg-upless0.0.3d13.aarch64pigsty5.2 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-18-pg-upless0.0.3u22.x86_64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-18-pg-upless0.0.3u22.aarch64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-18-pg-upless0.0.3u24.x86_64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-18-pg-upless0.0.3u24.aarch64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-18-pg-upless0.0.3u26.x86_64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-18-pg-upless0.0.3u26.aarch64pigsty4.9 KiBpostgresql-18-pg-upless_0.0.3-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_upless_170.0.3el8.x86_64pigsty11.5 KiBpg_upless_17-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_170.0.3el8.aarch64pigsty11.5 KiBpg_upless_17-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_170.0.3el9.x86_64pigsty11.5 KiBpg_upless_17-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_170.0.3el9.aarch64pigsty11.5 KiBpg_upless_17-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_170.0.3el10.x86_64pigsty11.6 KiBpg_upless_17-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_170.0.3el10.aarch64pigsty11.6 KiBpg_upless_17-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-17-pg-upless0.0.3d12.x86_64pigsty5.2 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-17-pg-upless0.0.3d12.aarch64pigsty5.2 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-17-pg-upless0.0.3d13.x86_64pigsty5.2 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-17-pg-upless0.0.3d13.aarch64pigsty5.2 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-17-pg-upless0.0.3u22.x86_64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-17-pg-upless0.0.3u22.aarch64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-17-pg-upless0.0.3u24.x86_64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-17-pg-upless0.0.3u24.aarch64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-17-pg-upless0.0.3u26.x86_64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-17-pg-upless0.0.3u26.aarch64pigsty4.9 KiBpostgresql-17-pg-upless_0.0.3-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_upless_160.0.3el8.x86_64pigsty11.5 KiBpg_upless_16-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_160.0.3el8.aarch64pigsty11.5 KiBpg_upless_16-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_160.0.3el9.x86_64pigsty11.5 KiBpg_upless_16-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_160.0.3el9.aarch64pigsty11.5 KiBpg_upless_16-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_160.0.3el10.x86_64pigsty11.6 KiBpg_upless_16-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_160.0.3el10.aarch64pigsty11.6 KiBpg_upless_16-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-16-pg-upless0.0.3d12.x86_64pigsty5.2 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-16-pg-upless0.0.3d12.aarch64pigsty5.2 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-16-pg-upless0.0.3d13.x86_64pigsty5.2 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-16-pg-upless0.0.3d13.aarch64pigsty5.2 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-16-pg-upless0.0.3u22.x86_64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-16-pg-upless0.0.3u22.aarch64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-16-pg-upless0.0.3u24.x86_64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-16-pg-upless0.0.3u24.aarch64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-16-pg-upless0.0.3u26.x86_64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-16-pg-upless0.0.3u26.aarch64pigsty4.9 KiBpostgresql-16-pg-upless_0.0.3-1PGSTY~resolute_all.deb
软件包版本平台仓库大小下载
pg_upless_150.0.3el8.x86_64pigsty11.5 KiBpg_upless_15-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_150.0.3el8.aarch64pigsty11.5 KiBpg_upless_15-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_150.0.3el9.x86_64pigsty11.5 KiBpg_upless_15-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_150.0.3el9.aarch64pigsty11.5 KiBpg_upless_15-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_150.0.3el10.x86_64pigsty11.6 KiBpg_upless_15-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_150.0.3el10.aarch64pigsty11.6 KiBpg_upless_15-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-15-pg-upless0.0.3d12.x86_64pigsty5.2 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-15-pg-upless0.0.3d12.aarch64pigsty5.2 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-15-pg-upless0.0.3d13.x86_64pigsty5.2 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-15-pg-upless0.0.3d13.aarch64pigsty5.2 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-15-pg-upless0.0.3u22.x86_64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-15-pg-upless0.0.3u22.aarch64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-15-pg-upless0.0.3u24.x86_64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-15-pg-upless0.0.3u24.aarch64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-15-pg-upless0.0.3u26.x86_64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-15-pg-upless0.0.3u26.aarch64pigsty4.9 KiBpostgresql-15-pg-upless_0.0.3-1PGSTY~resolute_all.deb

源码

pig build pkg pg_upless;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pg_upless;		# install by package name

pig install pg_upless -v 19;   # install for PG 19
pig install pg_upless -v 18;   # install for PG 18
pig install pg_upless -v 17;   # install for PG 17
pig install pg_upless -v 16;   # install for PG 16
pig install pg_upless -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION pg_upless CASCADE; -- requires plpgsql

用法

pg_upless: 检测无效 UPDATE

pg_upless 检测不改变任何实际值的 UPDATE 语句(ORM 中常见)。它通过在监控表上安装触发器并收集统计信息来工作。它作为诊断工具使用,不适合长期启用。

开始监控

-- 监控特定表
SELECT pg_upless_start('public', 'boats');

-- 监控模式中的所有表
SELECT pg_upless_start('public');

停止监控

-- 停止监控特定表
SELECT pg_upless_stop('public', 'boats');

-- 停止监控模式中的所有表
SELECT pg_upless_stop('public');

查看统计信息

该扩展在 pg_upless 模式中创建两个表:

  • pg_upless_stats – 存储每个表的总更新次数与无效更新次数
  • pg_upless_start_time – 记录监控开始时间(用于速率计算)

表格阅读器