Closed tvesely closed 5 years ago
VOPS is calculating aggregates on float4/float8 ytpe using double, while Postgres is accumulating result using numeric type.
Please also notice that result of sum of floating point values may depend on order of calculation. You can see in in vanilla Postgres:
499914.6792653507 (1 row)
499914.6792653515 (1 row)
499914.67926534865 (1 row)
You can notice small differences in results - it is because using of parallel plan for execution of this query:
Finalize Aggregate (cost=11614.55..11614.56 rows=1 width=8) -> Gather (cost=11614.33..11614.54 rows=2 width=8) Workers Planned: 2 -> Partial Aggregate (cost=10614.33..10614.34 rows=1 width=8) -> Parallel Seq Scan on ff (cost=0.00..9572.67 rows=416667 width=8) (5 rows)
So some small difference in the results is not an error.
We were running the example queries from your README, and noticed that heap and vops tables don't necessarily return the same results. When we ran this query, we noticed that the
float4
columns didn't match with the equivalent query in heap:In a simplified example:
When we run
sum(a)
on foo, it gets a number that is significantly different than a sum on vops_foo:Why does this happen? Is
vops_float4
incompatible with the standard float4? Is this a bug?