Re: Planner estimates cost of 'like' a lot lower than '='??

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Planner estimates cost of 'like' a lot lower than '='??
Дата
Msg-id 8869.995842359@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Planner estimates cost of 'like' a lot lower than '='??  (Mats Lofkvist <mal@algonet.se>)
Список pgsql-general
Mats Lofkvist <mal@algonet.se> writes:
> I just did a quick test before going to bed but 7.2devel seems
> do to what we want:

> testdb=> select count(*) from data where value like 'test_0';
>  count
> -------
>      9
> (1 row)

> testdb=> explain select count(*) from data where value like 'test_0';
> NOTICE:  QUERY PLAN:

> Aggregate  (cost=5581.45..5581.45 rows=1 width=0)
>   ->  Seq Scan on data  (cost=0.00..5580.69 rows=306 width=0)

> EXPLAIN
> testdb=> select count(*) from data where value >= 'test' and value < 'tesu';
>  count
> -------
>  10000
> (1 row)

> testdb=> explain select count(*) from data where value >= 'test' and value < 'tesu';
> NOTICE:  QUERY PLAN:

> Aggregate  (cost=6007.24..6007.24 rows=1 width=0)
>   ->  Seq Scan on data  (cost=0.00..5986.02 rows=8487 width=0)

> EXPLAIN

Those estimates do look a lot closer to reality, all right.  And the
join plan is the right thing now.  Excellent...

            regards, tom lane

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

Предыдущее
От: Mats Lofkvist
Дата:
Сообщение: Re: Planner estimates cost of 'like' a lot lower than '='??
Следующее
От: missive@frontiernet.net (Lee Harr)
Дата:
Сообщение: Re: Copy and serial type problem