1
Answer

DataTables vs. SQL Queries for Insertion

rtiltins

rtiltins

15y
2.6k
1
Hi All,

I have a situation where I'm working with three (sometimes four) datatables that require database select queries, and after some calculations and operations I need to insert my results into a new row. There are many similar processes - some are run daily, others weekly. The insertions themselves are numerous - daily ones are about 10,000 (6 columns) and the end-of-week ones can easily run to 40,000~50,000 (4 columns). These numbers are pretty reliable, and are unlikely to expand much in the future. Possibly 15,000 for the daily and 70,000 for end-of-week. What would be the best way to approach this? Should I be using DataTables and appending values to it, and then a bulk upload? or would it make more sense, if I'm looking for speed, to do individual Insert statements (creating a string each time). Would concurrency or multi-threading favour one option over the other, in case I want to experiment with further speed increases in the future? Which approach would you suggest for this problem?

Thanks in advance for your help.
Answers (1)