Hi,
On 2022-09-30 12:13:11 -0400, Tom Lane wrote:
> "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com> writes:
> > Hmm, I was not sure about additional conditions, sorry.
> > I could reproduce with followings steps:
>
> I tried this on a 32-bit VM with gcc 11.3, but couldn't reproduce.
> You said earlier
>
> >> OS: RHEL 6.10 server
> >> Arch: i686
> >> Gcc: 4.4.7
>
> That is an awfully old compiler; I fear I no longer have anything
> comparable on a working platform.
>
> The most likely theory, I think, is that that compiler is generating
> slightly different floating-point code causing different plans to
> be costed slightly differently than what the test case is expecting.
> Probably, the different orderings of the keys in this test case have
> exactly the same cost, or almost exactly, so that different roundoff
> error could be enough to change the selected plan.
Yea. I suspect that's because that compiler version doesn't have
-fexcess-precision=standard:
> CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wformat-security -fno-strict-aliasing -fwrapv -g -O2
It's possible one could work around the issue with -msse -mfpmath=sse instead
of -fexcess-precision=standard.
Greetings,
Andres Freund