I need some assistance in catching some inefficiencies in my backend workflow. It seems as though just scheduling the workflow is contributing to ~40% of my WU, where I am only looping through ~800 items and using ~13,800 WU
I am attempting so save on WU by getting a search of objects when initiating the workflow, then carrying that list and adding/subtracting on its next iteration. I am new when it comes to server-sided workflows and I am unsure if this is normal usage for the task, or wildly inefficient. This runs daily and uses on average ~18,000 WUs to process ~700-1000 items in a list.
This is the problemâŚevery iteration, the entire list of things is âfetchedâ again by Bubble, which means, if you start off at 800 items, youâve got 800 items fetched for the scheduling of first run, then on second run, youâve got 799 items fetched, then on 3rd run youâve got 798 items fetched and so on.
Better to on scheduling fetch the items, but have the backend workflow parameter be of type text as a list and not the âthingsâ, and when you send in the fetched list of things to that text parameter, send in the Unique IDsâŚthen add to your backend workflow a Make changes to thing and the thing to change will be âdo a search forâ with constraint of unique ID = list item (this is the text based list parameter that is the list of unique IDs).
With that setup you do not get charged for fetching the list of things each loop and the âdo a search forâ with constraint of unique ID is not an aggregate search and is just a single item search.
Another approach could be to use the schedule api workflow on a listâŚI suggest trying the API workflow on a list first to see how that affects WU consumption, and then test with first suggested approach to compare the two.
Thanks for your input! I always thought that anytime you âDo a search forâŚâ would perform a search on all lines and just return the single item. Are you saying that you are only charged WU for the list returned? If this is the case I have a lot of changes to make
You are charged for the search 0.3 WU and then charged for the list returned (items returned and each character of data returned)âŚthere used to be a list that showed the different activities but seems it has been removed from the internetâŚthat list showed a clear difference between charges for an aggregate search and a single item search (single item search when use the unique id as constraint or when using current page thing or when using get data from URL and set the type to a thing)
Itâs crazy that an optimisation hasnât been made here on Bubbleâs end. If you take a List of Things as a parameter and schedule the next workflow with List of Things:minus first item, it does a search, returns all the data and then passes the unique IDs to the workflow. A List of Things parameter is, behind the scenes, a list of unique IDs, so I wish itâd just manipulate that list instead of retrieving them all from DB againâŚ
I suggested it when I found out that this was true. @chris.williamson1996 was the first person to post about this. I contacted support and they confirmed this is what they do. I suggested they fix that since it is charging us unnecessarily to refetch a list that has already been fetched.
Another item on Bubble Boosts please in addition to the Search optimization that @brenton.strine was talking about
I think Bubble should spend some time on making users aware of this before going in for the next boost since only a subset of devs are aware of these shortcomings. In case this is picked up (and even if there are only a few things you want to fix), there wonât be any noticeable UI updates as such, but nevertheless, would be super important, that people will only appreciate once theyâre made aware of it