Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group