跳转到主要内容

pg_upless

Detect Useless UPDATE

pg_upless : Detect Useless UPDATE

Overview

ID Extension Package Version Category License Language
5180 pg_upless pg_upless 0.0.3 ADMIN PostgreSQL SQL
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----dt- No No No Yes no yes

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.0.3 19 18 17 16 15 pg_upless plpgsql
RPM PIGSTY 0.0.3 19 18 17 16 15 pg_upless_$v -
DEB PIGSTY 0.0.3 19 18 17 16 15 postgresql-$v-pg-upless -
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
el8.aarch64 N/A PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
el9.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
el9.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
el10.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
el10.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
d12.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
d12.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
d13.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
d13.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u22.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u22.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u24.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u24.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u26.x86_64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
u26.aarch64 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3 PIGSTY 0.0.3
Package Version OS ORG SIZE File URL
pg_upless_19 0.0.3 el9.x86_64 pigsty 11.5 KiB pg_upless_19-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_19 0.0.3 el9.aarch64 pigsty 11.5 KiB pg_upless_19-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_19 0.0.3 el10.x86_64 pigsty 11.6 KiB pg_upless_19-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_19 0.0.3 el10.aarch64 pigsty 11.6 KiB pg_upless_19-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-19-pg-upless 0.0.3 d12.x86_64 pigsty 5.2 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-19-pg-upless 0.0.3 d12.aarch64 pigsty 5.2 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-19-pg-upless 0.0.3 d13.x86_64 pigsty 5.2 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-19-pg-upless 0.0.3 d13.aarch64 pigsty 5.2 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-19-pg-upless 0.0.3 u22.x86_64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-19-pg-upless 0.0.3 u22.aarch64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-19-pg-upless 0.0.3 u24.x86_64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-19-pg-upless 0.0.3 u24.aarch64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-19-pg-upless 0.0.3 u26.x86_64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-19-pg-upless 0.0.3 u26.aarch64 pigsty 4.9 KiB postgresql-19-pg-upless_0.0.3-1PGSTY~resolute_all.deb
Package Version OS ORG SIZE File URL
pg_upless_18 0.0.3 el8.x86_64 pigsty 11.5 KiB pg_upless_18-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_18 0.0.3 el8.aarch64 pigsty 11.5 KiB pg_upless_18-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_18 0.0.3 el9.x86_64 pigsty 11.5 KiB pg_upless_18-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_18 0.0.3 el9.aarch64 pigsty 11.5 KiB pg_upless_18-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_18 0.0.3 el10.x86_64 pigsty 11.6 KiB pg_upless_18-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_18 0.0.3 el10.aarch64 pigsty 11.6 KiB pg_upless_18-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-18-pg-upless 0.0.3 d12.x86_64 pigsty 5.2 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-18-pg-upless 0.0.3 d12.aarch64 pigsty 5.2 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-18-pg-upless 0.0.3 d13.x86_64 pigsty 5.2 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-18-pg-upless 0.0.3 d13.aarch64 pigsty 5.2 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-18-pg-upless 0.0.3 u22.x86_64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-18-pg-upless 0.0.3 u22.aarch64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-18-pg-upless 0.0.3 u24.x86_64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-18-pg-upless 0.0.3 u24.aarch64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-18-pg-upless 0.0.3 u26.x86_64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-18-pg-upless 0.0.3 u26.aarch64 pigsty 4.9 KiB postgresql-18-pg-upless_0.0.3-1PGSTY~resolute_all.deb
Package Version OS ORG SIZE File URL
pg_upless_17 0.0.3 el8.x86_64 pigsty 11.5 KiB pg_upless_17-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_17 0.0.3 el8.aarch64 pigsty 11.5 KiB pg_upless_17-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_17 0.0.3 el9.x86_64 pigsty 11.5 KiB pg_upless_17-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_17 0.0.3 el9.aarch64 pigsty 11.5 KiB pg_upless_17-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_17 0.0.3 el10.x86_64 pigsty 11.6 KiB pg_upless_17-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_17 0.0.3 el10.aarch64 pigsty 11.6 KiB pg_upless_17-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-17-pg-upless 0.0.3 d12.x86_64 pigsty 5.2 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-17-pg-upless 0.0.3 d12.aarch64 pigsty 5.2 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-17-pg-upless 0.0.3 d13.x86_64 pigsty 5.2 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-17-pg-upless 0.0.3 d13.aarch64 pigsty 5.2 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-17-pg-upless 0.0.3 u22.x86_64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-17-pg-upless 0.0.3 u22.aarch64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-17-pg-upless 0.0.3 u24.x86_64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-17-pg-upless 0.0.3 u24.aarch64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-17-pg-upless 0.0.3 u26.x86_64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-17-pg-upless 0.0.3 u26.aarch64 pigsty 4.9 KiB postgresql-17-pg-upless_0.0.3-1PGSTY~resolute_all.deb
Package Version OS ORG SIZE File URL
pg_upless_16 0.0.3 el8.x86_64 pigsty 11.5 KiB pg_upless_16-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_16 0.0.3 el8.aarch64 pigsty 11.5 KiB pg_upless_16-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_16 0.0.3 el9.x86_64 pigsty 11.5 KiB pg_upless_16-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_16 0.0.3 el9.aarch64 pigsty 11.5 KiB pg_upless_16-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_16 0.0.3 el10.x86_64 pigsty 11.6 KiB pg_upless_16-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_16 0.0.3 el10.aarch64 pigsty 11.6 KiB pg_upless_16-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-16-pg-upless 0.0.3 d12.x86_64 pigsty 5.2 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-16-pg-upless 0.0.3 d12.aarch64 pigsty 5.2 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-16-pg-upless 0.0.3 d13.x86_64 pigsty 5.2 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-16-pg-upless 0.0.3 d13.aarch64 pigsty 5.2 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-16-pg-upless 0.0.3 u22.x86_64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-16-pg-upless 0.0.3 u22.aarch64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-16-pg-upless 0.0.3 u24.x86_64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-16-pg-upless 0.0.3 u24.aarch64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-16-pg-upless 0.0.3 u26.x86_64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-16-pg-upless 0.0.3 u26.aarch64 pigsty 4.9 KiB postgresql-16-pg-upless_0.0.3-1PGSTY~resolute_all.deb
Package Version OS ORG SIZE File URL
pg_upless_15 0.0.3 el8.x86_64 pigsty 11.5 KiB pg_upless_15-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_15 0.0.3 el8.aarch64 pigsty 11.5 KiB pg_upless_15-0.0.3-1PGSTY.el8.noarch.rpm
pg_upless_15 0.0.3 el9.x86_64 pigsty 11.5 KiB pg_upless_15-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_15 0.0.3 el9.aarch64 pigsty 11.5 KiB pg_upless_15-0.0.3-1PGSTY.el9.noarch.rpm
pg_upless_15 0.0.3 el10.x86_64 pigsty 11.6 KiB pg_upless_15-0.0.3-1PGSTY.el10.noarch.rpm
pg_upless_15 0.0.3 el10.aarch64 pigsty 11.6 KiB pg_upless_15-0.0.3-1PGSTY.el10.noarch.rpm
postgresql-15-pg-upless 0.0.3 d12.x86_64 pigsty 5.2 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-15-pg-upless 0.0.3 d12.aarch64 pigsty 5.2 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~bookworm_all.deb
postgresql-15-pg-upless 0.0.3 d13.x86_64 pigsty 5.2 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-15-pg-upless 0.0.3 d13.aarch64 pigsty 5.2 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~trixie_all.deb
postgresql-15-pg-upless 0.0.3 u22.x86_64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-15-pg-upless 0.0.3 u22.aarch64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~jammy_all.deb
postgresql-15-pg-upless 0.0.3 u24.x86_64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-15-pg-upless 0.0.3 u24.aarch64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~noble_all.deb
postgresql-15-pg-upless 0.0.3 u26.x86_64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~resolute_all.deb
postgresql-15-pg-upless 0.0.3 u26.aarch64 pigsty 4.9 KiB postgresql-15-pg-upless_0.0.3-1PGSTY~resolute_all.deb

Source

pig build pkg pg_upless;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install pg_upless;		# install via package name, for the active PG version

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 this extension with:

CREATE EXTENSION pg_upless CASCADE; -- requires plpgsql

Usage

pg_upless: Detect Useless UPDATE

pg_upless detects UPDATE statements that change no actual values (common with ORMs). It works by installing triggers on monitored tables and collecting statistics. It is intended as a diagnostic tool, not for permanent use.

Start Monitoring

-- Monitor a specific table
SELECT pg_upless_start('public', 'boats');

-- Monitor all tables in a schema
SELECT pg_upless_start('public');

Stop Monitoring

-- Stop monitoring a specific table
SELECT pg_upless_stop('public', 'boats');

-- Stop monitoring all tables in a schema
SELECT pg_upless_stop('public');

View Statistics

The extension creates two tables in the pg_upless schema:

  • pg_upless_stats – stores counts of total vs useless updates per table
  • pg_upless_start_time – records when monitoring started (for rate calculations)

表格阅读器