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

Re: Clustered index when not always in the WHERE clause

From: Brian Ghidinelli <brian(at)pukkasoft(dot)com>
To: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: Clustered index when not always in the WHERE clause
Date: 2010-10-29 21:05:36
Message-ID: 4CCB3720.9030402@pukkasoft.com (view raw or flat)
Thread:
Lists: sfpug
On 10/29/2010 1:36 PM, Josh Berkus wrote:
> Is the same event_id value shared by more than on club_id?  If so, then
> clustering won't benefit you at all for event_id queries.

Jeff and Josh, thanks for the replies.  Sorry I didn't clarify this in 
the original post but event_ids are unique to club_id.

Jeff Davis wrote:
>  - an event is only associated with one club (event_id determines
>    club_id)
>  - the combination of event and type is unique, but event is not
>    unique by itself (is this true?)

event_id does not need type to be unique actually; in this particular 
table 'where event_id = x' would be enough to return the right rows for 
our purposes.

Sounds like the clustered index on (club_id, event_id) will get the job 
done?  Thanks!


Brian

In response to

sfpug by date

Next:From: Richard BroersmaDate: 2010-10-29 23:03:59
Subject: Call For Talks: PGDay LA @ SCALE 9X
Previous:From: Josh BerkusDate: 2010-10-29 20:36:45
Subject: Re: Clustered index when not always in the WHERE clause

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