Re: PostgreSQL OR performance

Поиск
Список
Период
Сортировка
От Віталій Тимчишин
Тема Re: PostgreSQL OR performance
Дата
Msg-id 331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL OR performance  ("David Wilson" <david.t.wilson@gmail.com>)
Список pgsql-performance
Sorry, for delayed response - It was very busy week.

2008/11/7 David Wilson <david.t.wilson@gmail.com>
On Fri, Nov 7, 2008 at 4:14 AM, Віталій Тимчишин <tivv00@gmail.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.

В списке pgsql-performance по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Difference in query plan
Следующее
От: "Віталій Тимчишин"
Дата:
Сообщение: Re: PostgreSQL OR performance