There are currently some rather crude knobs for persuading the planner to favour certain kinds of query plans: the enable_XXX GUC variables. Several people have asked for a more flexible way to give hints to the planner. I'm not interested in implementing fully-general planner hints at the moment, but ISTM that a simple improvement to what we have now would allow for a wider range of planner hints with only minor changes: we could replace the enable_XXX variables with a set of variables that would add an arbitrary constant to the estimated cost of each type of query node. (Alternatively, an arbitrary multiplier could be specified; I'm not sure which would be better.)
This would also be useful when diagnosing bad query plans: for example, setting enable_seqscan=false often causes the planner to disregard the use of *any* sequential scan, anywhere in the plan. The ability to slightly bump up the cost of particular operations would allow more alternative plans to be examined. On the other hand, the whole mechanism is still a hack. It also means that applications using this will be more dependent on the actual costing values produced by the planner, which is not good. However, if you're in the sort of desperate straights where this sort of hackery is required, perhaps that's acceptable. Comments? -Neil ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org