Re: Indexs and prolems with.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indexs and prolems with.
Дата
Msg-id 8607.1013028627@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Indexs and prolems with.  ("Michael McAlpine" <mikem@vis.oregonian.com>)
Список pgsql-general
"Michael McAlpine" <mikem@vis.oregonian.com> writes:
> 1)  explain select * from table1 where charcol1 = 'asdfasd'
>      Index Scan using idx_charcol1  on table1  (cost=0.00..5.00 rows=1 width=456)

> 4)   explain select * from table1 where charcol2  = 'asdfasd'
>      Seq Scan on table1  (cost=0.00..234872.84 rows=168205 width=456)

Notice the difference in the estimated number of matching rows ---
that's what's persuading the planner that an indexscan would be a bad idea.
Why is that?  Is charcol2 full of lots of duplicates?

It'd be useful to know what version you are using and what you get from
(assuming 7.1)

select attname,attdispersion,s.*
from pg_statistic s, pg_attribute a, pg_class c
where starelid = c.oid and attrelid = c.oid and staattnum = attnum
and relname = 'table1';

            regards, tom lane

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

Предыдущее
От: "Sykora, Dale"
Дата:
Сообщение: Re: Postal code radius searches
Следующее
От: greg@turnstep.com
Дата:
Сообщение: Re: Commit , Rollback