Clarify planner_hook calling convention

From: "Andrey V(dot) Lepikhov" <a(dot)lepikhov(at)postgrespro(dot)ru>
To: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Clarify planner_hook calling convention
Date: 2022-01-03 07:33:13
Message-ID: 5eb6f0f3-4618-f835-ddc8-41c97b208551@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

planner hook is frequently used in monitoring and advising extensions.
The call to this hook is implemented in the way, that the
standard_planner routine must be called at least once in the hook's call
chain.

But, as I see in [1], it should allow us "... replace the planner
altogether".
In such situation it haven't sense to call standard_planner at all.
Moreover, if an extension make some expensive planning activity,
monitoring tools, like pg_stat_statements, can produce different
results, depending on a hook calling order.
I thought about additional hooks, explicit hook priorities and so on.
But, maybe more simple solution is to describe requirements to such kind
of extensions in the code and documentation (See patch in attachment)?
It would allow an extension developer legally check and log a situation,
when the extension doesn't last in the call chain.

[1]
https://www.postgresql.org/message-id/flat/27516.1180053940%40sss.pgh.pa.us

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
clarify_planner_hook_usage.diff text/x-patch 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-01-03 07:47:17 Re: Confused comment about drop replica identity index
Previous Message Pavel Stehule 2022-01-03 07:17:44 Re: Schema variables - new implementation for Postgres 15