Re: BUG #16136: Bug with cost calculation and JIT application

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: alexfilus(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16136: Bug with cost calculation and JIT application
Date: 2019-11-25 13:27:15
Message-ID: 20191125132715.qrbeytjrmhinba7m@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 25, 2019 at 01:00:34PM +0000, PG Bug reporting form wrote:
>The following bug has been logged on the website:
>
>Bug reference: 16136
>Logged by: Александр Филиппенко
>Email address: alexfilus(at)gmail(dot)com
>PostgreSQL version: 12.1
>Operating system: Ubuntu 18.04
>Description:
>
>I had very strange behaviour of optimizator.
>https://explain.depesz.com/s/GcHL
>https://explain.depesz.com/s/sTyG
>Both explains are for same query and same data set, but in second case I
>turn off JIT. I guess it's because of wrong cost calculation like this
>Nested Loop (cost=463.86..5575122.76 rows=652 width=74) (actual
>time=9.685..67.713 rows=18 loops=1)
>

Not sure what exactly you mean by "wrong cost calculation"?

The reason for the long duration with JIT seems pretty clear:

Functions: 237
Options: Inlining true, Optimization true, Expressions true, Deforming true
Timing: Generation 45.190 ms, Inlining 37.452 ms, Optimization 1292.680 ms, Emission 1076.752 ms, Total 2452.074 ms

That is, it took about 2.3s to optimize and emit the JIT code, most
likely because due to a fairly high number of functions. I'm not sure
that's something we can really fix, but there were discussions about
being smarter about optimizations etc.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Marco Cuccato 2019-11-25 15:07:48 Re: LDAPS trusted ca support
Previous Message PG Bug reporting form 2019-11-25 13:00:34 BUG #16136: Bug with cost calculation and JIT application