Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer

Поиск
Список
Период
Сортировка
От Vadim Mikheev
Тема Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer
Дата
Msg-id 36F14904.87062929@krs.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> 
> Let me tell you why I don't think this is a bug.  The optimizer will
> choose ordered results over unordered results if the costs are the same.
> In this case, the cost of the query is zero, so it chose to use the
> index because the index produces an ordered result.
> 
> This works well for un-vacuumed tables, because it thinks everything is
> zero cost, and chooses the index.

Agreed, this is ok as long as

vac=> create table table1 (field1 int);
CREATE
vac=> insert into table1 values (1);
INSERT 1583349 1
vac=> create index i_table1__field1 on table1 (field1);
CREATE
vac=> explain select * from table1 where field1 = 1;
NOTICE:  QUERY PLAN:

Seq Scan on table1  (cost=1.03 size=1 width=4)

- SeqScan is used for small tables.

So, only bug reported is left.

Vadim


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer