Re: Big table - using wrong index - why?

Поиск
Список
Период
Сортировка
Искать
От
Joe Conway
Тема
Re: Big table - using wrong index - why?
Дата
Msg-id
01d501c11916$b81603f0$48d210ac@jecw2k1
Список
Дерево обсуждения
Re: Big table - using wrong index - why? "Joe Conway" <joseph.conway@home.com>
> phones=# \d i_pl_pseq
>         Index "i_pl_pseq"
>  Attribute |         Type
> -----------+----------------------
>  entity    | character varying(3)
>  pseq      | bigint
> btree
>
> phones=# explain select * from phonelog where entity = '001' and pseq >=
> 9120 and pseq <= 9123;
> NOTICE:  QUERY PLAN:
>
> Index Scan using i_pl_loadtimestamp on phonelog  (cost=0.00..209247.39
> rows=607 width=137)
>
> EXPLAIN
>
> phones=# \d i_pl_loadtimestamp
>     Index "i_pl_loadtimestamp"
>  Attribute |         Type
> -----------+----------------------
>  entity    | character varying(3)
>  loaddate  | date
>  loadtime  | time
> btree

Just a guess, but what happens if you build i_pl_pseq(pseq, entity), i.e.
reverse the key fields? Also, has the table been vacuum analyzed?

-- Joe




В списке pgsql-sql по дате отправления
От: Jan Wieck
Дата:
От: John Oakes
Дата:
FAQ