I’d like to share a new PostgreSQL extension called pg_running_stats.
It implements mergeable, numerically stable running statistics using the Welford and Chan algorithms. Unlike the built-in aggregates such as avg(), variance(), and stddev(), which require scanning the entire dataset, pg_running_stats maintains a compact internal state that can be updated or merged incrementally.
This makes it well-suited for:
streaming or real-time analytics where data arrives continuously,
incremental computation over large tables,
parallel or distributed queries that need to merge partial aggregates efficiently.
The extension computes: mean, variance, standard deviation, skewness, kurtosis, and min/max all in a single pass.
It’s written entirely in C, depends only on PostgreSQL headers, and builds cleanly on macOS (Homebrew) and Linux using PGXS.
Any feedback, testing, or suggestions for improvement would be very welcome.
Thanks, Chanukya
Есть вопросы? Напишите нам!
✖
Чтобы сделать работу с сайтом удобнее, мы используем cookie и аналитический сервис «Яндекс.Метрика». Продолжая пользоваться сайтом, вы соглашаетесь с их использованием.