Re: [HACKERS] TODO list updated

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] TODO list updated
Дата
Msg-id 11526.947732113@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] TODO list updated  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [HACKERS] TODO list updated  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> We currently do not use indexes to handle ORDER BY because it is slower,

Er, actually, we *do* use indexes for ORDER BY currently:

regression=# explain select * from tenk1 order by unique1;
NOTICE:  QUERY PLAN:
Index Scan using tenk1_unique1 on tenk1  (cost=760.00 rows=10000 width=148)

If you start psql with PGOPTIONS="-fi" you can see that the optimizer
believes an explicit sort would be much slower:

regression=# explain select * from tenk1 order by unique1;
NOTICE:  QUERY PLAN:
Sort  (cost=3233.91 rows=10000 width=148) ->  Seq Scan on tenk1  (cost=563.00 rows=10000 width=148)

but (at least on my machine) the explicit sort is marginally faster.
Evidently, the cost estimate for an explicit sort is *way* too high.

I have been poking at this and am currently thinking that the CPU-vs-
disk scaling constants (_cpu_page_weight_ and cpu_index_page_weight_)
may be drastically off for modern hardware.  This is one of the
optimizer issues that I'm hoping to resolve for 7.0.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] TODO list updated
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] TODO list updated