Re: Big table - using wrong index - why?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Big table - using wrong index - why?
Дата
Msg-id 01d501c11916$b81603f0$48d210ac@jecw2k1
обсуждение исходный текст
Ответ на Big table - using wrong index - why?  ("Chris Ruprecht" <chrup999@yahoo.com>)
Список pgsql-sql
> 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
Дата:
Сообщение: Re: Why does this plpgslq always return 1?
Следующее
От: "John Oakes"
Дата:
Сообщение: plpgsql function return multiple values?