I have a table with Guid as the primary key. There were many rows in the table. In addition, I have a win service that performs a series of actions with each row (it may require reading and writing data from other databases). Therefore, processing a single line takes a lot of time. (on average about 100 seconds)
My winning service works as follows:
public class MyDto { public Guid Id { get; set; } } while (true){ if(time to start){ List<MyDto> rows = LoadData(); foreach(MyDto obj in rows){ Process(obj);
I need to reduce the execution time of all my lines. For some reason, I decided to increase the insatnces of my winning service. Therefore, I need each win service to execute its own set of strings.
I parameterized my fun LoadData() :
public List<MyDto> LoadData(int winServInstanceNumber){ }
So, I need a contribution function that depends on the total number of instances of the win instance and the inappropriate win service instance number.
Can you offer something better than
//on .net side obj.Id.GetHashCode()%totalWinServiceInstancesCount
or
--on sql side HASHBYTES('MD5', CAST(id as varbinary(16)))%totalWinServiceInstancesCount
source share