Why is this costing so much Workload Usage?

I reached out to Bubble support to get an answer to this issue…below is their response, and based on it, I think your assumption will hold true that it would be better to send a list of unique IDs as text and then for each loop perform a search for the single UID that is required for that loop.

Based on your message, I understand that, in this case, we’re discussing running a recursive workflow on a list of items – the list of items we’re recursing over was initially defined on the client as the displayed list within the Repeating Group.

You’re right – on the client, the search is done once when the page is loaded and the Repeating Group is displayed.

However, on the server, the items must be pulled with every call.

Here’s a timeline of what happens:

  1. The search for the Repeating Group runs, and it’s populated using a search. Workload units are charged to fetch these items.
  2. For these items, a call to the server is initiated, and the list parameter now needs to be populated for use in the recursive workflow.
  3. The server call uses instructions from the initial client-side call but not the data itself.
  4. Since we have instructions on what data to pull but not the actual data, we have to call the database to pull the actual data from the server.
  5. We receive instructions for the next recursive call on the server for the next items to pull.
  6. We make another database call using these instructions, consuming workload.
  7. We repeat steps 4 through 6 until the recursion ends.

In short, we use the list of users as a reference to determine what data to fetch from the server – but the list is simply a reference. The actual data will still need to be pulled, since everything happens on the server for backend workflows.

You can use the data sources for Repeating Groups as data sources for other elements on the page without accruing additional workload units. However, this isn’t true for server-side actions.

We cover this in our manual entry here:

Each action in an API workflow will also spend resources. Again, we need to keep in mind that on the front-end (the page), we can sometimes leverage client-side actions to move some of the processing away from the server, but in an API workflow everything happens server-side.

3 Likes