query should use an index?

Поиск
Список
Период
Сортировка
От Bopolissimus Platypus
Тема query should use an index?
Дата
Msg-id 200401101626.22371.bopolissimus@sni.ph
обсуждение исходный текст
Ответы Re: query should use an index?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
hello,

i've got a table that looks like this (irrelevant data removed);

create table test (
  id serial primary key,
  t_end timestamp);

there's an index:
  create index test_t_end on test(t_end);

can or should a query like:

  select login,t_end from test order by t_end desc;

use the index? explain says it does a sequential scan
and sort.  but it seems to me that if it's possible for the
postgresql to use the index to seek to the last record and
then step backward, then it could use the index. but of
course i don't know anything about postgresql internals
so i'm really just guessing or going with what seems likely,
but from a position of ignorance.

tiger

--
Gerald Timothy Quimpo  gquimpo*hotmail.com tiger*sni*ph
http://bopolissimus.sni.ph
Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"

    The best way to get rid of worries is to let them die of
     neglect.

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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: Hierarchical queries
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: query should use an index?