RE: Using BOOL in indexes

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: Using BOOL in indexes
Дата
Msg-id 000401bfcab7$b36aa580$2801007e@tpf.co.jp
обсуждение исходный текст
Ответ на Re: Using BOOL in indexes  (Andrew McMillan <Andrew@catalyst.net.nz>)
Список pgsql-hackers
> -----Original Message-----
> From: andrew@socrates.catalyst.net.nz
> 
> Hiroshi Inoue wrote:
> > Hiroshi Inoue wrote:
> > > Andrew McMillan wrote:
> > > >
> > > > Hi,
> > > >
> > 
> > Sorry,it wouldn't help unless there's an index e.g. on (head1,written,
> > story_id, released, title, precis, author).
> > However isn't (story_id) a primary key ?
> > If so,couldn't you change your query as follows ?
> > 
> > SELECT story.story_id, written, released, title, precis, author, head1
> > FROM story WHERE head1=TRUE ORDER BY head1, written DESC
> > LIMIT 15.
> 
> Thanks Hiroshi,
> 
> I already have such an index, but as you can see below, it is still not
> used:
> 
> newsroom=# explain SELECT story.story_id, written, released, title,
> precis, author, head1 FROM story WHERE head1=TRUE ORDER BY head1,
> written DESC LIMIT 15;

Oops,please add DESC to head1 also i.e ORDER BY head1 DESC,written DESC.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp


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

Предыдущее
От: Andrew McMillan
Дата:
Сообщение: Re: Using BOOL in indexes
Следующее
От: Grant Finnemore
Дата:
Сообщение: Re: SET FSYNC command?