"Alexei" <alexei_novakov@yahoo.com> writes:
> .... Although the result
> of the query always was correct whichever plan it's using. I repete - I did
> not do anything between queries, but just ran the same 'explain select ...'
> sequentially. The query itself is heavy, but pretty strightforward - 2
> tables joined 12 times.
With 12 tables you'll be using the geqo optimizer by default, and it has
a random component to the plans by design. It's a bit disappointing
that it doesn't consistently find plans of about the same quality
though. Can you provide a complete test case? (No, the bare text of
a query isn't a test case...)
regards, tom lane