Language

PostgreSQL

First appeared
1996
Paradigm
Declarative (SQL)
Toolchain
PostgreSQL 18.6
Container image
postgres:18.6-trixie

SQL is where most data already lives, and PostgreSQL brings a lot of statistics with it: avg, stddev_samp, var_samp, percentile_cont, corr, and regr_slope are all built-in aggregates. The from-scratch versions avoid them and use only basic aggregates such as sum, count, min, and max, plus ordinary arithmetic and window functions. SQL describes results rather than steps, so iterative methods take some ingenuity: k-means repeats its two steps with a recursive query, WITH RECURSIVE.

Quirks

Concepts in PostgreSQL

Run the examples locally

You need Docker and Python 3. The harness builds the pinned container and runs every PostgreSQL example:

git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language postgresql