Re: [HACKERS] Non-deterministic behavior with floating point in parallel mode - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Non-deterministic behavior with floating point in parallel mode
Date
Msg-id 3455.1486046960@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] Non-deterministic behavior with floating point in parallel mode  (Ruben Buchatskiy <ruben@ispras.ru>)
Responses Re: [HACKERS] Non-deterministic behavior with floating point inparallel mode  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
Ruben Buchatskiy <ruben@ispras.ru> writes:
> We have found that in parallel mode result of queries is non-deterministic
> when the types of the attributes in table are double precision
> (floating-point).

Yeah ...

> That is because floating-point addition is not necessarily associative.

Right, exactly.

> Is this desirable behavior?

It's not especially the fault of parallelism.  Any change in the order in
which the SUM visits the rows could cause a similar change in the results.
IOW, you are being overoptimistic about how deterministic this result
is any of the time.

Use numeric, not float, if you can't tolerate this sort of behavior.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: [HACKERS] Enabling replication connections by default inpg_hba.conf
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATE and DELETE