Hello
. I have a table with a lot of records (11 million). Entries have an external identifier, date, and some other fields.
I have a query that I often run in my application. The query looks something like this:
if( SELECT * FROM myTable WHERE Date=@Date AND ForeignID=@ForeignID != 0 )
UPDATE myTable SET ....... WHERE Date=@Date AND ForeignID=@ForeignID
else
INSERT INTO myTable(......) VALUES(.....)
I want to add "Date" as a non-clustered index. Then, if I add the "ForeignID" column as the included column for this index, will it help the query run faster?
Thank.
source
share