Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2010-05-13 : 15:38:42
|
| what is the best way to improve query performance for m to m relatioship table ?I have Fact/Diemsnions which has M-2-M relationshipFact Patid measures (amt)100110021003 DiagnosisBridgePatid Diagnosis_ID 1001 11001 21001 3etc Diagnosis TableDiagnosisID DiagnosisCode1 900.012 900.033 900.344 Etc… I want to return the query aginst these table as quick as possible ... what is the best way to optimize m to m relationship table structure .. so it returns the result quickly ? |
|
|
dtecmeister
Starting Member
5 Posts |
Posted - 2010-05-13 : 22:36:33
|
| From your example data it looks like this is a one-to-many relationship followed by a one-to-one relationship. Ignoring that, you would want to add a bridge_id column and primary key followed by an index on Patid, an index on Diagnosis_ID, and a unique index on (Patid,Diagnosis_ID). I hope this helps and good luck. |
 |
|
|
|
|
|