Same rows, different SUM 0 ▲ boringSQL | Supercharge your SQL & PostgreSQL powers 150 days ago · 11 min read2276 words · Tech · hide · Fediverse post Everyone knows not to store money as a double precision. One can hope. The rule is so well drilled that it has stopped being interesting, and it is also not where the trouble usually starts. The float is already in the schema before anyone weighs in on it: a measurement column someone later sums for a report, telemetry that drifts into a finance dashboard, a third-party feed ingested as double precision because that is how it arrived. Here is the part the rule does not warn you about. Take a table of five million floating-point readings, sum the column, and run it three times in a row. Nothing else touches the table. Same connection, same data, same statement. SELECT sum(reading) FROM measurements; sum -------------------- 2500519211.7874823 sum ------------------- 2500519211.787477 sum -------------------- 2500519211.7874575 Three runs, three different totals. No UPDATE, no concurrent writer, no random seed. The rows did not change between runs, and the query is the same character… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town