i've created a data governance tool, in one module of which i schedule a job that runs a few sql queries. It is now running synchronously but i want to convert it to a way that it runs faster.
the question is, should i use Parallel or Task or Async/Await method in order to achieve what i want?
EDIT:these queries are completely different from each other. They each run a different data quality checks on different columns or tables. These are all select queries, and i use the ExecuteScalar method returning only the count of the rows that breaks my quality rules, such as "how many null values in ABC column" I scheduled them to run at night as soon as DWH is populated
asyncwon't make anything run faster, it will release a thread that would be blocked otherwise. Individual queries will be slower than their sync versions though. Parallel execution will decrease performance due to increased locking. Batching queries or passing multiple values inIN()orVALUES()clauses is a lot faster. SqlBulkCopy for bulk inserts is another fast optionParallel.ForEach(jobs,job=>runJob(job));,var jobTasks=allJobs.Select(job=>Task.Run(()=>runJob(job))orjobTasks =await Task.WhenAll(allJobs.Select(job=>runJobAsync(job))). Should you do so though? Or would this result in slower execution due to blocking? All queries run on the disks, RAM