I want to speed up following piece of code
delete from ssn_sdo
where
(art_id=@art_id and skl_id=@skl_id and @level=0 )
or (art_id=@art_id and skl_id=@skl_id and @level=1 and tip=@tip)
or (art_id=@art_id and skl_id=@skl_id and doc_id = @doc_id)
My server is MS SQL-Server 2005.
art_id
,skl_id
and doc_id
are integers, while tip is varchar(10)
type of.
I want to make an index(es) on ssn_sdo
table so this delete is going to faster.
What I was considering to do is to make three indexes, each one for every case:
doc_id (ASC), art_id (ASC), skl_id (ASC)
skl_id (ASC), art_id (ASC), tip (ASC)
skl_id (ASC), art_id (ASC),
Or is there better way to make one index which will include all three cases.
I am careful with indexes because I do not want to slow down inserts in this table.