Which option for searching/retrieving is lighter?

I’m having some trouble getting WU down and fully understanding… there’s an essential search that was quite heavy in my app (turned it from about 30 - 60 WU per page load, to about 9WU). In essence it’s a simple marketplace for Businesses, where data structure for a business is something like:

Business > List of Shops > List of Products (per each Shop) > Product.

I also have a data type thing Post, but that is separate and it’s for our social network feed that just loads Posts. It’s nowhere near as heavy. But I experimented with it too.

Basically, I just want to show businesses in a repeating group! The only things displayed in each cell are profile picture, thumbnail, name and description.

I’ve had many overages and I had a hard time figuring out what it was… I deleted many searches, but it all mostly narrowed down to simply searching for businesses, which was consuming nearly 89% of all our WU from search, with search consuming A LOT of our WU:

I’ve “improved it” but I’m still not feeling 100% about what is what… I know searches can be 0.3 WU, but feels quite vague as sometimes they can be more. I saw the search for businesses (with a very simple yes/no constraint), for example, consistently consume about 15 - 25WU per page load as I experimented through different methods.

This was the original hellish search causing havoc:
Captura de pantalla 2024-08-04 082822

Can someone help me figure out what is the best way to display businesses given this case? Seemed like a simple enough search to m… Or just help me understand better why I got the results I did after switching from A) to C)?

A) Do a Search for Businesses (so far the worst and the original). *There was actually a day where we had about 40,000 WU consumed (on a 175k plan…), and 89% was mostly this search. We had under 20 users active. Seems counterintuitive, I thought Bubble was smart enough to ignore unused items from a search. Would get 20 - 40WU per page load.

B) Do a Search for Shops, and source the Business’ information from the Shop like: Current cell’s Business’ business_name. (A shop has a data field Business, so it can be retrieved). Would still get 24 - 35 WU per page load.

C) I added a “Business” data field to the Post data thing. Since our Posts repeating group is consistently about 2WU and was only about 3% of WU on average, I thought mixing them in may be a good idea, as a mere guess frankly. So our original repeating group to dislpay Bussinesses, we set up the source to be the Repeating Group Post (with the list of posts):filtered Business isn’t empty:each item’s Business. Of course, we created a post for each business beforehand. Ended up with 9 - 13 WU per page load. Not great, but better.

D) (have not tried) Delete the “List of Shops” data field from the Business type, and keep the near original option A), which is a simple Do a search for Businesses. In this case if I were to retrieve the Shop elsewhere, I’d just have to set it’s source to “do a search for Shops, constrained by Business = uniqueidorxyz” instead of doing “This businesses’ Shops: filtered by X”… but it means I’d ultimately have to do more frequent searches as users navigate different shops and… sounds counter-intuitive.

Can anyone explain which is better supposedly? And why has option C been the best? Like I said, I thought Bubble was smart enough to ignore unused items, which makes me wonder if there’s many other weird logics I’ve skipped around the app.

I really need to figure this out before we start scaling a little more. Makes it a bit scary that it took me guess theories to arrive at this and the most intuitive and simple option was actually quite far from what I had to do. I’d like a more structured logic to understand and employ from now on but don’t know how to approach searches or structuring from now on…

My initial thought was to remove random sorting. It always drives up th WUs as it will fetch a very large number of data all at once.

Second is,

While this data structure is very good and simple, I have recently found that due to various reasons, in the long term, Do a search for will be a better alternative to business’s Shops’s Products.

Always keep the searchable data light.

Due to the data structure, your searchable data is heavy. This might also be the reason why you were successful with Options B and C. (I do not know exact data so I am taking some assumptions)

If not already done, ensure proper privacy settings.

Try a bit with the suggestions. Hopefully you will find what works for you.

Edit: You might also like to see some posts by @boston85719 on the subject. He has some great advices.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.