Same rows, different SUM 0 ▲ boringSQL | Supercharge your SQL & PostgreSQL powers 1 hour ago · 11 min read2276 words · Tech · hide · 0 comments 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… No comments yet. Log in to reply on the Fediverse. Comments will appear here.