As an experiment, I made the attached patch that converts add_path's cost comparisons to "fuzzy" comparisons --- two paths are considered to have the same cost if it differs by less than 1% of the smaller total_cost. I found that this reduced the planning time of Eric's query by about 40%, without changing the resulting plan. On more typical queries where the relations all have different statistics, I doubt it would have as much effect, but I'm inclined to apply the change anyway.
It looks like a great idea to me...
> + * XXX does this percentage need to be user-configurable?
...but I think the answer to the above is yes.
Joe
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org