jlsmithhartfiel
Programmer
Hello!
Ok, I think I understand the clustered vs non & single vs composite.
Now I'm working with a table that already has indexes defined. And I'm just trying to determine if I need to add another one or not. (my forte is not SQL!)
Question 1:
So, here's what exists:
INDEX Uid on Uid
CLUSTERED INDEX ix_fieldname on FieldName, TStamp
Now, at times I need to find all the records for a UID, AND FieldName AND TStamp.
Now will SQL use both the indexes above together if all 3 fields are referenced, or will I need to add another index that has all 3 fields in it?
Question 2:
2nd Table is a codes table where you look up values based on a code.
Indexes are:
UNIQUE INDEX Uid on Uid
INDEX FieldName on FieldName
When I look for a record in this table, I look for the FieldName first (which may be "counties"
and then the value which is the code. To get the lable for the value.
Now, I'm a little confused because it seems the rules say that if all the records are different (where the values are for this set of FieldName), then don't add an index. Is that right? Or would I want to add another index on FieldName, Value.
Thanks in advance for any clarification! Jessica![[ponytails2] [ponytails2] [ponytails2]](/data/assets/smilies/ponytails2.gif)
Ok, I think I understand the clustered vs non & single vs composite.
Now I'm working with a table that already has indexes defined. And I'm just trying to determine if I need to add another one or not. (my forte is not SQL!)
Question 1:
So, here's what exists:
INDEX Uid on Uid
CLUSTERED INDEX ix_fieldname on FieldName, TStamp
Now, at times I need to find all the records for a UID, AND FieldName AND TStamp.
Now will SQL use both the indexes above together if all 3 fields are referenced, or will I need to add another index that has all 3 fields in it?
Question 2:
2nd Table is a codes table where you look up values based on a code.
Indexes are:
UNIQUE INDEX Uid on Uid
INDEX FieldName on FieldName
When I look for a record in this table, I look for the FieldName first (which may be "counties"
Now, I'm a little confused because it seems the rules say that if all the records are different (where the values are for this set of FieldName), then don't add an index. Is that right? Or would I want to add another index on FieldName, Value.
Thanks in advance for any clarification! Jessica
![[ponytails2] [ponytails2] [ponytails2]](/data/assets/smilies/ponytails2.gif)