Re: Diff between Primary key and non primary key select

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Diff between Primary key and non primary key select
Дата
Msg-id 87y94ij46y.fsf@stark.dyndns.tv
обсуждение исходный текст
Ответ на Diff between Primary key and non primary key select  (Deepa <kdeepa@midascomm.com>)
Список pgsql-general
Deepa <kdeepa@midascomm.com> writes:

>         In the above result, I cannot able to see much difference between
> the time consumed using primary key and non-primary key value. Even in
> some cases, I can able to see that using non primary key value retrieves record faster
> than  using primary key.

Try running "analyze tablename". If you don't run analyze periodically
postgres won't know about changes in the data such as a table growing large
enough to warrant using an index.

If that doesn't help, run your query in psql with the word "explain" before it
and send the results. Also send the output of \d tablename.

explain will say exactly what postgres is doing to run your query. It looks
like the query with the primary key may not be using an index.

--
greg

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Diff between Primary key and non primary key select
Следующее
От: Jeff Eckermann
Дата:
Сообщение: Re: Postgres Databases growing without much reason