Re: allowing extensions to control planner behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allowing extensions to control planner behavior
Date: 2024-08-26 17:37:34
Message-ID: 2909615.1724693854@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I'm somewhat expecting to be flamed to a well-done crisp for saying
> this, but I think we need better ways for extensions to control the
> behavior of PostgreSQL's query planner.

Nah, I won't flame you for that, it's a reasonable thing to think
about. However, the devil is in the details, and ...

> The attached patch, briefly mentioned above, essentially converts the
> enable_* GUCs into RelOptInfo properties where the defaults are set by
> the corresponding GUCs.

... this doesn't seem like it's moving the football very far at all.
The enable_XXX GUCs are certainly blunt instruments, but I'm not sure
how much better it is if they're per-rel. For example, I don't see
how this gets us any closer to letting an extension fix a poor choice
of join order. Or, if your problem is that the planner wants to scan
index A but you want it to scan index B, enable_indexscan won't help.

> ... On the other hand, the more I look at
> what our enable_* GUCs actually do, the less impressed I am. IMHO,
> things like enable_hashjoin make a lot of sense, but enable_sort seems
> like it just controls an absolutely random smattering of behaviors in
> a way that seems to me to have very little to recommend it, and I've
> complained elsewhere about how enable_indexscan and
> enable_indexonlyscan are really quite odd when you look at how they're
> implemented.

Yeah, these sorts of questions aren't made better this way either.
If anything, having extensions manipulating these variables will
make it even harder to rethink what they do.

You mentioned that there is prior art out there, but this proposal
doesn't seem like it's drawing on any such thing. What ideas should
we be stealing?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-08-26 17:38:59 Re: thread-safety: getpwuid_r()
Previous Message Robert Haas 2024-08-26 17:35:52 Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch