Re: Determining which index to create

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема Re: Determining which index to create
Дата
Msg-id 3BFC5C29.8C52C9B7@tpf.co.jp
обсуждение исходный текст
Ответ на Re: Determining which index to create  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Determining which index to create
Список pgsql-general
Martijn van Oosterhout wrote:
>
> On Wed, Nov 21, 2001 at 04:09:52PM +0100, Eric Cholet wrote:
> > => explain select * from dico_frs where motid=4742 order by date desc limit
> > 10;
> > NOTICE:  QUERY PLAN:
> >
> > Limit  (cost=46172.25..46172.25 rows=10 width=16)
> >   ->  Sort  (cost=46172.25..46172.25 rows=11382 width=16)
> >         ->  Index Scan using dico_frs_motid_date on dico_frs
> > (cost=0.00..45405.39 rows=11382 width=16)
>
> That's wrong. It doesn't seem to realise that a reverse scan on the index
> would give the right answer. Note that that's only true because you're
> selecting only a single motid. If there were multiple, a reverse scan would
> definitly not be appropriate.

Please try
  select * from dico_frs where motid=4742 order by motid desc,
  date desc limit 10;

regards,
Hiroshi Inoue

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

Предыдущее
От: Dado Feigenblatt
Дата:
Сообщение: backup: restoring, problems with permissions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: backup: pg_dumpall and full backups in general