Hello, SQL 2008R2
If I have a query that has a where clause like WHERE Column1 = 'hello' AND Column2 = '9/16/2012'.
I already have an index on Column1 but was thinking I needed an index on Column2. So, I have several ways to go, but I do not know which would be the best. Here are my ideas:
The last one I do not think would be the best, but might help.
Thus my question is which would help the most. Queries again only Column2 might be done.
Thanks
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
If I have a query that has a where clause like WHERE Column1 = 'hello' AND Column2 = '9/16/2012'.
I already have an index on Column1 but was thinking I needed an index on Column2. So, I have several ways to go, but I do not know which would be the best. Here are my ideas:
Code:
CREATE INDEX IX_Column2 ON Mytable(Column2);
CREATE INDEX IX_Column1_Column2 ON Mytable(Column1, Column2);
CREATE INDEX IX_Column1_Column2 ON Mytable(Column1) INCLUDE (Column2);
Thus my question is which would help the most. Queries again only Column2 might be done.
Thanks
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!