Re: In PG12, query with float calculations is slower than PG11

Amit Langote <amitlangote09@gmail.com>

From: Amit Langote <amitlangote09@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Emre Hasegeli <emre@hasegeli.com>, nospam-pg-abuse@bloodgate.com, Tomas Vondra <tomas.vondra@2ndquadrant.com>, keisuke kuroda <keisuke.kuroda.3862@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-02-14T04:29:08Z
Lists: pgsql-hackers
On Fri, Feb 14, 2020 at 3:47 AM Andres Freund <andres@anarazel.de> wrote:
> On 2020-02-13 13:40:43 -0500, Tom Lane wrote:
> > ... and pushed.  One other change I made beyond those suggested
> > was to push the zero-divide ereport's out-of-line as well.
>
> Thanks!

Thank you all.

I repeated some of the tests I did earlier and things look good.

gcc-8
=====

HEAD

latency average = 296.842 ms

    42.05%  postgres  postgres           [.] ExecInterpExpr
    15.14%  postgres  postgres           [.] float8_accum
     9.32%  postgres  libc-2.17.so       [.] __isinf
     7.32%  postgres  postgres           [.] dsqrt
     5.67%  postgres  postgres           [.] float8mul
     4.20%  postgres  postgres           [.] ftod

11.7

latency average = 289.439 ms

    41.52%  postgres  postgres           [.] ExecInterpExpr
    13.59%  postgres  libc-2.17.so       [.] __isinf
    10.98%  postgres  postgres           [.] float8_accum
     8.26%  postgres  postgres           [.] dsqrt
     6.17%  postgres  postgres           [.] float8mul
     3.65%  postgres  postgres           [.] ftod

clang-7
=======

HEAD

latency average = 233.735 ms

    43.84%  postgres  postgres           [.] ExecInterpExpr
    15.17%  postgres  postgres           [.] float8_accum
     8.25%  postgres  postgres           [.] dsqrt
     7.35%  postgres  postgres           [.] float8mul
     5.84%  postgres  postgres           [.] ftod
     3.78%  postgres  postgres           [.] tts_buffer_heap_getsomeattrs

11.7

latency average = 221.009 ms

    49.55%  postgres  postgres           [.] ExecInterpExpr
    12.05%  postgres  postgres           [.] float8_accum
     8.97%  postgres  postgres           [.] dsqrt
     6.72%  postgres  postgres           [.] float8mul
     5.62%  postgres  postgres           [.] ftod
     2.18%  postgres  postgres           [.] slot_deform_tuple

HEAD and PG 11 are now comparable even when built with gcc.

Regards,
Amit



Commits

  1. Avoid a performance regression in float overflow/underflow detection.

  2. Provide separate header file for built-in float types