Robert Haas <robertmh...@gmail.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