On Thu, 2009-01-15 at 19:37 -0600, Jason Long wrote:
> >
> > > I have not looked into the detail of the explain, and I do see visually
> > > that very different plans are being chosen.
> > >
> >
> > It would help to share these plans with us...
> >
> See EXPLAIN ANALYZE below for three different plans @ .5, 6, and 84
> seconds
Well, it's clear why you're getting a variety of plans. With that many
tables in the FROM list, there are a huge number of possible plans, so
PostgreSQL will use a genetic algorithm to try to find the best one,
which is based on random numbers.
My only advice would be to step back for a minute and see if there might
be a better way to solve the original problem. Typically, numbers in
table and field names are a sign something could be better designed.
I may have some better advice if you say why you are joining so many
tables, and what the numbers are for.
Regards,
Jeff Davis