mirror of
https://github.com/postgres/postgres.git
synced 2026-03-09 09:40:40 -04:00
When computing statistical aggregates like variance, the common schoolbook algorithm which computes the sum of the squares of the values and subtracts the square of the mean can lead to a large loss of precision when using floating point arithmetic, because the difference between the two terms is often very small relative to the terms themselves. To avoid this, re-work these aggregates to use the Youngs-Cramer algorithm, which is a proven, numerically stable algorithm that directly aggregates the sum of the squares of the differences of the values from the mean in a single pass over the data. While at it, improve the test coverage to test the aggregate combine functions used during parallel aggregation. Per report and suggested algorithm from Erich Schubert. Patch by me, reviewed by Madeleine Thompson. Discussion: https://postgr.es/m/153313051300.1397.9594490737341194671@wrigleys.postgresql.org |
||
|---|---|---|
| .. | ||
| data | ||
| expected | ||
| input | ||
| output | ||
| sql | ||
| .gitignore | ||
| GNUmakefile | ||
| Makefile | ||
| parallel_schedule | ||
| pg_regress.c | ||
| pg_regress.h | ||
| pg_regress_main.c | ||
| README | ||
| regress.c | ||
| regressplans.sh | ||
| resultmap | ||
| serial_schedule | ||
| standby_schedule | ||
Documentation concerning how to run these regression tests and interpret the results can be found in the PostgreSQL manual, in the chapter "Regression Tests".