Re: In PG12, query with float calculations is slower than PG11 - Mailing list pgsql-hackers

From Amit Langote
Subject Re: In PG12, query with float calculations is slower than PG11
Date
Msg-id CA+HiwqErtkftp8yUA2KaapCijWjCfOk-N251hwUREsv5dUugEw@mail.gmail.com
Whole thread Raw
In response to Re: In PG12, query with float calculations is slower than PG11  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: In PG12, query with float calculations is slower than PG11
List pgsql-hackers
Fwiw, also tried the patch that Kuroda-san had posted yesterday.

On Fri, Feb 7, 2020 at 5:17 PM Amit Langote <amitlangote09@gmail.com> wrote:
> Latency and profiling results:
>
> gcc 8 (gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3))
> ====
>
> 11.6
>
> latency average = 463.968 ms
>
>     40.62%  postgres  postgres           [.] ExecInterpExpr
>      9.74%  postgres  postgres           [.] float8_accum
>      6.12%  postgres  libc-2.17.so       [.] __isinf
>      5.96%  postgres  postgres           [.] float8mul
>      5.33%  postgres  postgres           [.] dsqrt
>      3.90%  postgres  postgres           [.] ftod
>      3.53%  postgres  postgres           [.] Float8GetDatum
>      2.34%  postgres  postgres           [.] DatumGetFloat8
>      2.15%  postgres  postgres           [.] AggCheckCallContext
>      2.03%  postgres  postgres           [.] slot_deform_tuple
>      1.95%  postgres  libm-2.17.so       [.] __sqrt
>      1.19%  postgres  postgres           [.] check_float8_array
>
> HEAD
>
> latency average = 549.071 ms
>
>     31.74%  postgres  postgres           [.] ExecInterpExpr
>     11.02%  postgres  libc-2.17.so       [.] __isinf
>     10.58%  postgres  postgres           [.] float8_accum
>      4.84%  postgres  postgres           [.] check_float8_val
>      4.66%  postgres  postgres           [.] dsqrt
>      3.91%  postgres  postgres           [.] float8mul
>      3.56%  postgres  postgres           [.] ftod
>      3.26%  postgres  postgres           [.] Float8GetDatum
>      2.91%  postgres  postgres           [.] float8_mul
>      2.30%  postgres  postgres           [.] DatumGetFloat8
>      2.19%  postgres  postgres           [.] slot_deform_heap_tuple
>      1.81%  postgres  postgres           [.] AggCheckCallContext
>      1.31%  postgres  libm-2.17.so       [.] __sqrt
>      1.25%  postgres  postgres           [.] check_float8_array
>
> HEAD + patch
>
> latency average = 546.624 ms
>
>     33.51%  postgres  postgres           [.] ExecInterpExpr
>     10.35%  postgres  postgres           [.] float8_accum
>     10.06%  postgres  libc-2.17.so       [.] __isinf
>      4.58%  postgres  postgres           [.] dsqrt
>      4.14%  postgres  postgres           [.] check_float8_val
>      4.03%  postgres  postgres           [.] ftod
>      3.54%  postgres  postgres           [.] float8mul
>      2.96%  postgres  postgres           [.] Float8GetDatum
>      2.38%  postgres  postgres           [.] slot_deform_heap_tuple
>      2.23%  postgres  postgres           [.] DatumGetFloat8
>      2.09%  postgres  postgres           [.] float8_mul
>      1.88%  postgres  postgres           [.] AggCheckCallContext
>      1.65%  postgres  libm-2.17.so       [.] __sqrt
>      1.22%  postgres  postgres           [.] check_float8_array

HEAD + Kuroda-san's patch (compiled with gcc 8)

latency average = 484.604 ms

    37.41%  postgres  postgres            [.] ExecInterpExpr
    10.83%  postgres  postgres            [.] float8_accum
     5.62%  postgres  postgres            [.] dsqrt
     4.23%  postgres  libc-2.17.so        [.] __isinf
     4.05%  postgres  postgres            [.] float8mul
     3.85%  postgres  postgres            [.] ftod
     3.18%  postgres  postgres            [.] Float8GetDatum
     2.81%  postgres  postgres            [.] slot_deform_heap_tuple
     2.63%  postgres  postgres            [.] DatumGetFloat8
     2.46%  postgres  postgres            [.] float8_mul
     1.91%  postgres  libm-2.17.so        [.] __sqrt

> clang-7 (clang version 7.0.1 (tags/RELEASE_701/final))
> =====
>
> 11.6
>
> latency average = 419.014 ms
>
>     47.57%  postgres  postgres           [.] ExecInterpExpr
>      7.99%  postgres  postgres           [.] float8_accum
>      5.96%  postgres  postgres           [.] dsqrt
>      4.88%  postgres  postgres           [.] float8mul
>      4.23%  postgres  postgres           [.] ftod
>      3.30%  postgres  postgres           [.] slot_deform_tuple
>      3.19%  postgres  postgres           [.] DatumGetFloat8
>      1.92%  postgres  libm-2.17.so       [.] __sqrt
>      1.72%  postgres  postgres           [.] check_float8_array
>
> HEAD
>
> latency average = 452.958 ms
>
>     40.55%  postgres  postgres           [.] ExecInterpExpr
>     10.61%  postgres  postgres           [.] float8_accum
>      4.58%  postgres  postgres           [.] dsqrt
>      3.59%  postgres  postgres           [.] slot_deform_heap_tuple
>      3.54%  postgres  postgres           [.] check_float8_val
>      3.48%  postgres  postgres           [.] ftod
>      3.42%  postgres  postgres           [.] float8mul
>      3.22%  postgres  postgres           [.] DatumGetFloat8
>      2.69%  postgres  postgres           [.] Float8GetDatum
>      2.46%  postgres  postgres           [.] float8_mul
>      2.29%  postgres  libm-2.17.so       [.] __sqrt
>      1.47%  postgres  postgres           [.] check_float8_array
>
> HEAD + patch
>
> latency average = 452.533 ms
>
>     41.05%  postgres  postgres           [.] ExecInterpExpr
>     10.15%  postgres  postgres           [.] float8_accum
>      5.62%  postgres  postgres           [.] dsqrt
>      3.86%  postgres  postgres           [.] check_float8_val
>      3.27%  postgres  postgres           [.] float8mul
>      3.09%  postgres  postgres           [.] slot_deform_heap_tuple
>      2.91%  postgres  postgres           [.] ftod
>      2.88%  postgres  postgres           [.] DatumGetFloat8
>      2.62%  postgres  postgres           [.] float8_mul
>      2.03%  postgres  libm-2.17.so       [.] __sqrt
>      2.00%  postgres  postgres           [.] check_float8_array

HEAD + Kuroda-san's patch (compiled with clang-7)

latency average = 435.454 ms

    43.02%  postgres  postgres           [.] ExecInterpExpr
    10.86%  postgres  postgres           [.] float8_accum
     3.97%  postgres  postgres           [.] dsqrt
     3.97%  postgres  postgres           [.] float8mul
     3.51%  postgres  postgres           [.] ftod
     3.42%  postgres  postgres           [.] slot_deform_heap_tuple
     3.36%  postgres  postgres           [.] DatumGetFloat8
     1.97%  postgres  libm-2.17.so       [.] __sqrt
     1.97%  postgres  postgres           [.] check_float8_array
     1.88%  postgres  postgres           [.] float8_mul

Needless to say, that one makes a visible difference, although still
slower compared to PG 11.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: Assumptions about the number of parallel workers
Next
From: Antonin Houska
Date:
Subject: Re: [HACKERS] WIP: Aggregation push-down