RE: Using BOOL in indexes

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Andrew McMillan" <Andrew(at)catalyst(dot)net(dot)nz>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Using BOOL in indexes
Date: 2000-05-31 04:21:32
Message-ID: 000401bfcab7$b36aa580$2801007e@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: andrew(at)socrates(dot)catalyst(dot)net(dot)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(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Grant Finnemore 2000-05-31 05:12:04 Re: SET FSYNC command?
Previous Message Andrew McMillan 2000-05-31 04:01:15 Re: Using BOOL in indexes