public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chanukya SDS <[email protected]>
To: [email protected]
Subject: pg_running_stats - mergeable running statistics (Welford/Chan) extension for postgresql
Date: Fri, 17 Oct 2025 11:23:47 +0530
Message-ID: <CAB4f4B5cXFEGr09MUgyFxeoa-QBEqMoNUp7HTpNey7G96Jt6qw@mail.gmail.com> (raw)
In-Reply-To: <CAB4f4B55BCn7eOc+cY5HhwERXxhsSLjHneQhsUsH16n86Bp+0g@mail.gmail.com>
References: <CAB4f4B55BCn7eOc+cY5HhwERXxhsSLjHneQhsUsH16n86Bp+0g@mail.gmail.com>

Hi all,

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:

   1. streaming or real-time analytics where data arrives continuously,
   2. incremental computation over large tables,
   3. 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.

Source and documentation:
https://github.com/chanukyasds/pg_running_stats

Any feedback, testing, or suggestions for improvement would be very welcome.

Thanks,
Chanukya


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pg_running_stats - mergeable running statistics (Welford/Chan) extension for postgresql
  In-Reply-To: <CAB4f4B5cXFEGr09MUgyFxeoa-QBEqMoNUp7HTpNey7G96Jt6qw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox