From: | Віталій Тимчишин <tivv00(at)gmail(dot)com> |
---|---|
To: | "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: PostgreSQL OR performance |
Date: | 2008-11-15 13:55:38 |
Message-ID: | 331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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)
> (actual
> > 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
> statistics.
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.
Nothing've changed
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Віталій Тимчишин | 2008-11-15 13:57:03 | Re: PostgreSQL OR performance |
Previous Message | Richard Huxton | 2008-11-14 17:14:17 | Re: Difference in query plan |