Re: slower merge join on sorted data chosen over nested loop

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: slower merge join on sorted data chosen over nested loop
Дата
Msg-id 28283.1128652118@sss.pgh.pa.us
обсуждение исходный текст
Ответ на slower merge join on sorted data chosen over nested loop  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> In both the 8.1beta2 and using a build from this morning's
> dev snapshot, this query ran slower than expected:

There's a known issue that the planner tends to overestimate the cost of
inner-index-scan nestloops, because it doesn't allow for the strong
caching effects associated with repeated scans of the same index (in
particular, that all the upper index levels tend to stay in cache).
See the archives for past inconclusive discussions about how to fix
this.

However, something else caught my eye:

>                ->  Bitmap Heap Scan on "DbTranRepository" dtr  (cost=297.07..47081.47 rows=25067 width=17) (actual
time=69.056..5560.895rows=39690 loops=1)
 

>          ->  Index Scan using "DbTranRepository_timestamp" on "DbTranRepository" dtr  (cost=0.00..49419.45 rows=25067
width=17)(actual time=33.625..11510.723 rows=39690 loops=1)
 

I don't understand why the second case chose a plain index scan when
there was no need for sorted output; the bitmap scan is faster both
per cost estimate and in reality.  Are you sure you turned off only
enable_mergejoin and not enable_bitmapscan?

Also, when you say "slower than expected", what is setting your
expectation?
        regards, tom lane


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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Vote needed: revert beta2 changes or not?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Vote needed: revert beta2 changes or not?