Sorry, for delayed response - It was very busy week.
2008/11/7 David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>
> On Fri, Nov 7, 2008 at 4:14 AM, Віталій Тимчишин <tivv00(at)gmail(dot)com> wrote:
> > "Merge Join (cost=518771.07..62884559.80 rows=1386158171 width=32)
> > time=30292.802..755751.242 rows=34749 loops=1)"
> Have you tried increasing the default_statistics_target? The planner
> is expecting 1.3 billion rows to be produced from a query that's only
> actually producting 35k, which probably indicates some very bad
The planner seems to think that every second pair from company<->company
join will succeed with this join expression (1386158171 ~ 52648^2 / 2).
That is not true.
Anyway, I've tried to set default_statistics_target to 1000, then analyze.
At the same time, the materialize step produces 242
> million rows when the planner only expects to produce 2.3, indicating
> a similar problem in the opposite direction. This probably means that
> the planner is choosing plans that would be optimal if it was making
> good guesses but are decidedly sub-optimal for your actual data.
That is even more strange, because materialize step must produce exactly the
rows it takes from sort, that is 2316503, so I don't get how table scan +
sort + materialize can multiply number of rows by 100.
In response to
pgsql-performance by date
|Next:||From: Віталій Тимчишин||Date: 2008-11-15 13:57:03|
|Subject: Re: PostgreSQL OR performance|
|Previous:||From: Richard Huxton||Date: 2008-11-14 17:14:17|
|Subject: Re: Difference in query plan|