Running Long Workflows in Background & Avoiding DB Slowdowns / Deadlocks

I’m currently using a Retool Workflow that executes 15–20 database queries sequentially. The workflow typically takes 15–20 minutes to complete.

:rotating_light: Problem:

While the workflow is running:

  • Any other database-related tasks I perform (from the Retool UI or other apps) become very slow.
  • Sometimes I even encounter deadlocks in the database.

:bulb: Questions:

  1. Can I run a Retool workflow completely in the background so that it doesn't block or affect other user actions in the app?

  2. Some of my queries in the workflow are independent — is it possible to run multiple queries in parallel within a workflow to reduce total execution time?

  3. A few queries do hit the same table, but they're not logically dependent. Would this still cause contention or deadlocks? Any best practices to avoid that?

  4. What are some recommended ways to structure long-running workflows that reduce performance impact on other operations?