I need to insert some records into a database at a time when it normally it's not being used, what are some approaches I can take? I have considered using the SQL Server Agent to run some stored procedures, or I could schedule a program to do the insertions too, ideally if the process takes more than 1 hour It should be able to stop and continue where it left off next time. Any suggestions on how can I do this cleanly, the technology to be used is .Net Core with Dapper, and the DB Server is MSSQLS 2016.

  • 1
    Welcome to "Software Engineering". This is a site for conceptual programming questions, so the best answer you can get here is "yes, the concept of using a scheduler is ok for your task". When it comes to specific technologies, better ask elsewhere, for example, your favorite searach engine would be a good start. You can try on Stackoverflow instead, but make sure you read their help center first. In the current form, I would expect your question to be closed there as well as it going to be closed and deleted here. – Doc Brown Nov 10 '18 at 8:08
  • @DocBrown I'm no asking for implementation details, I just wanted way to do this, I mentioned the technologies because that's what I'm using but if there is a different. I was looking for an answer similar to Ewan's actually. I mentioned the technologies so that the contraints could be known. – Immac Nov 12 '18 at 14:32
  • If you want suggestions for a better concept, I recommend you better don't ask "which approach can I take? Currently, my approach is <list of technologies>". Better edit your question and make clear the technologies work only as examples, and the focus is elsewhere. – Doc Brown Nov 12 '18 at 15:29

I would strongly advise you to avoid using scheduling tasks for low useage periods as a solution to long running jobs.

The problem with the approach is that these periods are not guarenteed to exist. Either you simply run out of hours in the day to schedule the tasks or your useage patterns change shrinking or ellimintaing the low periods.

Instead, implement a throttle so that the task can run at any time, but the speed of the task can be reduced so that it doesnt hog all the resources.

With a bit of clever programming you can monitor the speed of your database/api responses and dynamically throttle the application back as they slow down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.