What is the most efficient way to run a large number of simple queries without overloading the db?

By user7127000

Let’s say I have a method

public async Task SaveItemToDb(ItemEntity item) { ... }

which saves a single item the db and let’s say I need to run it with 500,000 items and for business reasons I can’t do bulk operations (e.g. I can’t make a SaveItemsToDb(IEnumerable items)).

I’m wondering what the best way is to do this so that I don’t overload the db with queries running simultaneously and yet each query can be considered independent of each other. Is this the case for Task.WhenAll(...)?

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273