title: Running a large amount of activity functions from data from a database
body: <p>We have a database with around 400k elements we need to compute. Below is shown a sample of an orchestrator function.</p>
  
  <pre><code>[FunctionName("Crawl")]
  public static async Task&lt;List&lt;string&gt;&gt; RunOrchestrator(
  [OrchestrationTrigger] DurableOrchestrationContext context)
  {
     if (!context.IsReplaying)
     {
     }
  
     WriteLine("In orchistration");
     var outputs = new List&lt;string&gt;();
  
     var tasks = new Task&lt;string&gt;[3];
  
     var retryOptions = new RetryOptions(
         firstRetryInterval: TimeSpan.FromSeconds(60),
         maxNumberOfAttempts: 3);
  
     // Replace "hello" with the name of your Durable Activity Function.
     tasks[0] = context.CallActivityWithRetryAsync&lt;string&gt;("Crawl_Hello",retryOptions, "Tokyo");
     tasks[1] = context.CallActivityWithRetryAsync&lt;string&gt;("Crawl_Hello", retryOptions, "Seattle");
     tasks[2] = context.CallActivityWithRetryAsync&lt;string&gt;("Crawl_Hello",retryOptions, "London");
  
     await Task.WhenAll(tasks);
  
     return outputs;
  }
  </code></pre>
  
  <p>Every time an activty is called the orchestration function is called. But I dont want to get 400k items from the database each time an activity is getting called. Would just just add all the activity code inside the if statement or what is the right approach here? I can't see that working with the WaitAll function.</p>