Patrox wrote:
Quote:
hi !
I would like to know if with Postgres 8.2 is there any way to force a
query execution plan ?
For example to use a specific index at a speciifc moment during the
execution ?
This possibilty exists within oracle with the /*+ blabla*/ hints which
can be written inside one's query since ages.
I'm eager to find the same possibility with Postgres ...
Any idea about that ? |
This is better asked at, say, pgsql.general (a moderated newsgroup),
There are statistics variables in Postgres that tell the query planner the
relative costs of things like a page fetch, a sort and so on. Generally,
though, tweaking the planner causes a degradation of performance, since it's
pretty good at telling when the overhead of an index is going to overtake the
overhead of, say, a table scan. This depends on factors like how selective
the index is; an index on a uniformly distributed boolean value is unlikely to
help much, for example. The ability of the planner to tell how selective an
index is, or how long a table scan might take, is dependent on how good its
statistics are for the tables under query. This in turn depends on good DBA
practices, like running a frequent VACUUM ANALYZE.
I'll bet you ten credits that your hand-tweaked plan runs worse than PG's
planner would come up with if the statistics were accurate, and twenty that
it's no better.
--
Lew