For medians and percentiles, Greenwald and Khanna defined an ε-approximate quantile summary: one that answers any quantile within εN ranks. Karnin, Lang and Liberty's KLL sketch is mergeable, a property they call extremely important because large datasets are often distributed across many machines. DataSketches' KLL default of K = 200 gives about 1.65% rank error. The t-digest is built to be most accurate near the tails, and Dunning and Ertl note that t-digests from disjoint partitions can be formed independently and then combined, which makes parallel processing simple.
Predict
A sketch promises 1% rank error. For the median of a billion orders, how far off can the answer's rank be?
The big systems expose these directly. Spark's approxQuantile implements a variation of Greenwald-Khanna, and its percentile_approx takes an accuracy whose reciprocal is the relative error, 10,000 by default. BigQuery's documentation states the trade plainly: approximate aggregate functions scale in time and resource usage, but give approximate results.
Pick an answer above to see the rest
Predict
You store each day's median order value. Can 30 daily medians give the month's median?
BigQuery's KLL functions are built for that: they allow partial aggregations and re-aggregations.