Le 7 juil. 09 à 19:37, Greg Stark a écrit :
I propose that there's a maximum reasonable planning time

It sounds so much like the planner_effort GUC that has been talked about in the past...
  http://archives.postgresql.org/pgsql-performance/2009-05/msg00137.php

...except this time you want to measure it in seconds. The problem with measuring it in seconds is that when the time has elapsed, it's uneasy to switch from classic to geqo and avoid beginning from scratch again.
Would it be possible to start geqo from current planner state?

Another idea would be to have more complex metrics for deciding when to run geqo, that is guesstimate the query planning difficulty very quickly, based on more than just the number of relations in the from: presence of subqueries, UNION, EXISTS, IN, or branches in where clause, number of operators and index support for them, maybe some information from the stats too... The idea would be to - set an effort threshold from where we'd better run geqo (GUC, disabling possible)
 - if threshold enabled, compute metrics
 - if metric >= threshold, use geqo, if not, classic planner
 - maybe default to disabling the threshold

It seems it'd be easier to set the new GUC on a per query basis...

The obvious problem to this approach is that computing the metric will take some time better spent at planning queries, but maybe we could have fast path for easy queries, which will look a lot like $subject.

Regards,
--
dim

I hope this will give readers better ideas than its bare content...
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to