sql - Why does speed increases when updating datetime column with index -
i have sql server 2014 ctp2 database table datetime
column called expirationdate
has non-unique, non-clustered index.
the index creation statement is:
create index ix_expirationdate on my_table (expirationdate);
my c# application (self-hosted wcf service) uses ado.net
select & update queries my_table
table.
i created test application performs following scenario:
select
1 item databaseselect top (1) id, expirationdate, ... my_table (nolock) status = 1 , ... order my_table.expirationdate asc
change item in test application
item.status = 2;
item.expirationdate = datetime.now.addhours(2);update
item in databaseupdate my_table set expirationdate = @expirationdate, status = 2, ... (my_table.id = @id);
i have 2 cases in application:
- change
expirationdate
in test application before database update - not change
expirationdate
in test application before database update
i run test application 10000 items in database , results show first case 4x faster second.
can please explain why there such huge performance gain if datetime
column index
updated?
Comments
Post a Comment