pg_median_utils
Median filter and iterative median filter window functions for PostgreSQL
pg_median_utils · Median filter and iterative median filter window functions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100613 | pg_median_utils | pg_median_utils | 0.0.1 | FUNC | MIT | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
- pg_median_utils documentation at the reviewed commit
- pg_median_utils.control at the reviewed commit
- Installed SQL API
- Window-function implementations
- Current PGXN distribution page
pg_median_utils provides five double precision window functions: median_filter, iterated_median_filter, rolling_median, backfilled_rolling_median, and rolling_median_impute. They operate on the ordered rows of each window partition and require an odd window size.
Rolling Median
The first two rows return null because a complete three-row trailing window is not yet available.
Caveats
- Catalog, control, and the actual extension install script report
0.0.1, while documentation, tags, metadata, and PGXN label the distribution0.0.7. Do not use the distribution label asALTER EXTENSIONtarget unless a matching SQL upgrade path exists. - Ordering comes from the
OVERclause; the functions inspect partition positions rather than a caller-defined SQL window frame. Always specify deterministic ordering. - Pass a positive odd window size. The C code rejects even values but converts the signed SQL argument to an unsigned integer before validation, so a negative odd value can become a huge allocation or loop bound.
- The iterative filter repeatedly processes an entire partition until convergence, and imputation builds partition-sized arrays. Bound partition and window sizes and test backend memory and latency.
- Upstream says PostgreSQL 9.6 or later, but the C window-API code has no current compatibility matrix.