October Is Scary Schema Month

Ayende kicked the month off with "Schema to wince by…", then "CRM Horror".

Great timing, Ayende! With Halloween right around the corner, let's make October scary schema month!

Here is one that recently made my hair stand on end:

ALTER TABLE [dbo].[EmergencyPatientAssesments]
   
ADD CONSTRAINT [mspk550470] PRIMARY KEY CLUSTERED
(
   
[BaseID] ASC,
   
[PatientVisitID] ASC,
   
[TreatmentID] ASC,
   
[DateTime] ASC,
   
[ActualDateTime] ASC,
   
[AssessmentSequenceID] ASC,
   
[QuestionID] ASC
) ON [PRIMARY]

This healthcare schema defines a composite primary key using 5 varchar fields and 2 datetime fields. If you think the index is scary, you should see the joins…

Do you have a scary schema to share?

posted on Tuesday, October 09, 2007 9:12 PM by scott

Comments

Tuesday, October 09, 2007 6:33 PM by Sahil Malik

# re: October Is Scary Schema Month

EEEeeeeeeeeeeeeeeeeeeeeeeeek!!
Tuesday, October 09, 2007 8:53 PM by Simon

# re: October Is Scary Schema Month

After discussing this with team mates the feeling was that this is fine for a fact table in a data warehouse using a star schema.

Was a new one on me but..

http://en.wikipedia.org/wiki/Star_schema
Wednesday, October 10, 2007 9:03 AM by scott

# re: October Is Scary Schema Month

Technically correct, but still scary ;)
Thursday, October 11, 2007 7:25 PM by Christopher Steen

# Link Listing - October 11, 2007

Link Listing - October 11, 2007
Thursday, October 11, 2007 7:28 PM by Christopher Steen

# Link Listing - October 11, 2007

Regional SharePoint Users Conference October 27-28 [Via: Gary Blatt ] SOAP/TCP Transport for WCF [Via:...