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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer
Дата
Msg-id 199903181836.NAA05613@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer  (Vadim Mikheev <vadim@krs.ru>)
Список pgsql-hackers
> > It is possible the new optimizer fixes this.  He needs to try the new
> > snapshot to see.
> 
> vac=> create table table1 (field1 int);
> CREATE
> vac=> create index i_table1__field1 on table1 (field1);
> CREATE
> vac=> explain select * from table1 where field1 = 1;
> NOTICE:  QUERY PLAN:
> 
> Index Scan using i_table1__field1 on table1  (cost=0.00 size=0 width=4)
> 
> Unfixed...
> 

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.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


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

Предыдущее
От: Terry Mackintosh
Дата:
Сообщение: Re: [ADMIN] delete data
Следующее
От: Vadim Mikheev
Дата:
Сообщение: Re: [HACKERS] Re: [BUGS] General Bug Report: Bug in optimizer