Question about clustered indices. I have a table like:
Clubs are 1-n to events in my system. In this particular table there
are times when the event_id will be null. I'll be running two queries:
WHERE club_id = 'a' AND type = y
WHERE event_id = 'b' AND type = z
If I understand the value of clustering correctly, it would be best to
have a clustered index on (club_id, event_id). This would put all of
the rows with the same club_id together and all of the event_id rows
together which will benefit both queries above, correct?
Originally I thought about clustering only on club_id which would get
similar event_ids close but not perfectly in order. Any reason not to
cluster on the multiple column index?
This table has say 1mm rows but filtering by club_id or event_id will
reduce the results down to less than a couple hundred rows in most cases.
sfpug by date
|Next:||From: Jeff Davis||Date: 2010-10-29 19:46:30|
|Subject: Re: Clustered index when not always in the WHERE clause|
|Previous:||From: Joe Brenner||Date: 2010-10-23 22:11:48|
|Subject: Re: SFPUG/PGX Happy Hour|