Re: BUG #17871: JIT during postgresql_fdw remote_estimates EXPLAIN have very negatively effect on planning time

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: maxim.boguk@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2023-03-27T21:28:30Z
Lists: pgsql-bugs
Hi,

On 2023-03-27 08:04:59 +0000, PG Bug reporting form wrote:
> postgresql_fdw remote estimated  explain calls could trigger JIT compilation
> on the remote side (why explain without analyze trying use JIT at all???),
> and with partitioned tables it will lead to very slow planning.

It should not trigger all of JIT, just generating the bitcode, but not
optimizing / emitting it.

> Checking what's going on the remote side leads to the following results:
> remote estimate explain calls from fdw with jit=on
> [EXPLAIN] LOG:  duration: 97.050 ms  statement: EXPLAIN SELECT topic_id,
> review_id, move_to_invitation_state_time, no_interview_reply_time,
> review_suggestion_chat_message_creation_time FROM
> public.interview_review_info_archive
> vs
> remote estimate explain calls from fdw with jit=off
> [EXPLAIN] LOG:  duration: 3.343 ms  statement: EXPLAIN SELECT topic_id,
> review_id, move_to_invitation_state_time, no_interview_reply_time,
> review_suggestion_chat_message_creation_time FROM
> public.interview_review_info_archive

Can you show the explain plan for the remote queries?

Greetings,

Andres Freund