Having to request Bubble support to look into some charges for WUs and fetching data as well as referencing data from an RG.
I have an RG, it is set to have a fixed number of Rows. So, only 4 items from the search are displayed, however, the entire ‘list of things’ count is already available in the RG as can be seen in the debugger.
When I asked support why I was charged 0.20 WUs for the text element reference to the RG list of things count, the explanation received was below
If your repeating group is only showing a portion of the results of a “Do a search” operation, our system only fetches the portion that is displayed. For example, when you have a repeating group that is showing 4 items, and the database has more than 4 items for that specific search query, our system only fetches the 4 items, and therefore does not have access to the total count of the results of the search. The reason why a list of things will incur 0.20 additional units when you access the :count is because the request to “count all the results” and “show the first 4 items” are considered separate requests in our system. So, we have to do an additional aggregate search to get the complete count.
Please note that if your repeating group is showing all of the items for the specific search query, referencing the count will not query additional WU.
In the simple setup, there is an RG, fixed rows of 4, and a text element, with reference to RG list of things count
Although the support agents reply can sound logical, it doesn’t make actual sense when we can see Bubble already has the count (as can be seen in the screen shot from the debugger)…so WHY, would the system, that already has the count and exposes the count on the RG element, consider the dynamic expression referencing the RG list of things count as a separate request?
It’s only when you open the debugger that the count request is run. It’s not loaded when the data is retrieved. When you search for items 1-4 in a larger list, you cannot tell how many items are left - all that Bubble returns is a boolean saying ‘is this the end of the list’.
When you open the debugger, a new aggregate search is run to get the list in the RG. You’ll see that if you load the page, turn off your internet, then open the RG in the debugger, the count will be empty as it couldn’t make the count request.
So, yes the count is available, but only because you asked for it in the debugger.
TLDR, when you open debugger on an RG, it makes a :count request to get the count. It’s not accessing something that’s already been requested.
I didn’t know before I just checked - but the docs are accurate in this particular case (though that’s not to say it’s perfect in other cases), where it’s pretty clear that aggregate searches are distinct from regular searches, and that it costs 0.2 WU. I don’t think there’s anything in the docs that would lead someone to believe that the count is loaded every time any search is done.
I’ve helped build apps in the ‘code world’ and we never had to do so many scientific calculations and configurations that took a scientific mind to figure out the cost.
I really hope bubble comes up with something better.
I like Bubble…but I think they can do better with their pricing model.
I know, I’m not trying to be overgenerous to Bubble and there’s still a lot of work for Bubble to do on WU (lots of which should’ve been done months / a year and a half ago) but I was just pointing out that this particular instance probably isn’t the worst offender out there.
For example, that :first item is empty / :count is 0 bug is now finally a ticket in Bubble’s system thanks to Fede bringing it to attention again so hopefully it’ll be attended to and more bug fixes will follow where they’re necessary.
Hoping we’ll get some peeks on improving observability shown at BubbleCon. And again, like you, I do really wish stuff like that was in place when WU was announced in the first place. But, we’re here now, so I know I’ll be trying to help Bubble do the best they can, even though I don’t agree with everything they do!
When you open the debugger, a new aggregate search is run to get the list in the RG. You’ll see that if you load the page, turn off your internet, then open the RG in the debugger, the count will be empty as it couldn’t make the count request.
That sounded plausible. I just checked and it is not what I am experiencing.
It may be that in your RG, you are showing the entire list (i.e 4 out of 4 items). The debugger might be making an optimisation that will prevent the :count request as it knows it has found the last item (from the search request), and knows how many are already in the Repeating Group. In that case, it would be nice if Bubble made the same optimisation on their end, but there’s a whole host of reasons that that exact change might not be possible.
It’s never as simple as us lowly Bubble devs like to think - I imagine that when Bubble checks a count in a workflow, for example, it has to do so again because the method the debugger uses to check the count might be different and manipulateable on the client side, which you wouldn’t want to be possible with your workflows (maybe someone wants to take a poke around the debugger code and find out, but it’s not going to be me)
I’m using a text element with dynamic expression referencing the repeating groups list of things count.
In your video, the experience is different than mine, so I thought to check with another approach.
In my first attempt, the text element was on the page still, which is referencing the RG list of things count…when I turned off the internet, I could see on the RG the list of things count.
So, I tried with deleting the text element, previewing the page, then turning off internet, and now the RG list of things count is empty, although it should be 4 because that is how many items are in the RG.
So it would seem that the text element reference to the RG list of things count, forces Bubble to do the aggregate count and then they apply it to the RG.
What is strange about that though, is I would expect that the count would be how many items are in the RG at the moment, and not the total count of all items from the database. If we use an RG with an items from or items until operators, the RG list of things count shows only the number of items in the RG, and not the entire count of things that would have been fetched from the database. Meaning, since the fixed number of rows is 4 and the search only returns first 4 items, why then would the list of things on the RG be greater than 4? Bubble must be somehow registering that the datasource was searching for all items and assuming that although the RG has a fixed number of rows, and is only showing 4 items, that the reference to the RG list of things count actually wants the number of things that the datasource would have returned rather than what the actual count of things in the RG is.
It’s so easy to do like for loop or do while condition in other languages.
But We can only use recurring workflow to implement some simple functions. It’s so slow and expensive….(wus and wus)
And in some cases infinity loops occurs while the condition fails… even the logic is right in other languages.
I wanted to check on an extension of this.
I have an RG and in a separate text element I display the count of elements in the RG. Only if the count is >=1 that text is clickable. And when clicked on the text, the RG is made visible.
Now in this setup, how do you suggest I’ll be charged WUs in case of zero results and non zero results? I mean because if the system is considering RG’s search and RG’s count search as separate queries, then if the RG is invisible, then RG’s search shouldn’t be run unless it is made visible and hence I shouldn’t be charged WUs?
Will it be like as shown below?
Search results zero:
Only charge WUs for count query
Search result non-zero but text not clicked (RG invisible)
Only charge WUs for count query
Search result non-zero and text clicked (RG visible)
Charge WUs for count query + WUs for RG’s data source
Put a group on the page of type number, put datasource as the Do search for thing count. Make the text show the Groups Number…they both incur same WU costs, however, the RG list of things count makes it so the RG is populated with a search no matter what, whether the count is 0 or more than 0, still a search is taking place, and whether or not the user clicks on the text to show RG or not.
Instead, put onto the RG a condition based on the group counts number being greater than 0 and change data source property to be the search for thing.
Thanks, yeah I would do that now. I had not done it earlier as I did not want to duplicate the search expression (One for the count text and one for RG) as it is a maintenance overhead to keep the two separate. I was also under the impression like you that since RG is already there, the count shouldn’t incur extra WUs. I had expected that RG’s query would run even if it is invisible if the count text is there as it would be accessing RG’s data source, but I was okay with it to avoid maintenance overhead.
Are you saying that it would run even if RG is invisible and its data is not being accessed anywhere? Or you were saying in my context it will run even if it is not visible if I am accessing its data?
It is bit silly if it works like described below:
Invisible RG’s data query won’t run if RG’s data is not being accessed anywhere
Invisible RG’s data query will run even if RG’s data’s count is being accessed somewhere (Even though the count query will be considered separate and will incur WUs)
It is super silly if it works like this:
Invisible RG’s data query would run irrespective of whether data is being accessed or not
@boston85719 just checking if you could clarify on the point I had mentioned in my previous post on how invisible RGs cost WUs. Can you clarify how exactly it works as per your understanding?
I’m not sure, I have not ran a test on that to see, but I think the RG data query runs no matter what, so long as it is in the data source. I just put a condition onto the hidden RG for when I want the data and use the property to change to set the datasource.
Yeah, I think there is a difference in understanding between the use of invisible or hidden. I’ve been a big advocate for years for the use of a floating group set beneath the page to be used for elements like an RG of reference or plugin elements so as to be able to access their values without disrupting the design of the page and it’s responsive layout.
In the event the user is using a hidden RG, one that is in the floating group set beneath the page, that RG will run the search no matter what, which is why I suggest to put a condition onto it to change the datasource so that it runs the search only when it needs to. I’m not sure if @mghatiya was using invisible as invisible or a reference to what I refer to has hidden (ie: in the floating group not visible to the user, but visible to the client device, and hidden from sight and other elements).
@mghatiya@georgecollier is correct to state that invisible RGs do not fetch data if they are unused, and this has been a long established known of how Bubble works. @georgecollier is also correct that the only way to know is to test for each of your use cases with the network tab. @mghatiya it is also correct that a RG placed into a floating group set beneath the page (so is visible to the client device but not the eyes of the client), does run a search even if it is not referenced or used anywhere.
To run your tests in network tab, it is very simple.
First open your preview page
Open your browser dev tools (I use chrome)
Select Network
Refresh your browser
Look at what comes up, and most importantly, focus on finding the below three value sets
maggregate is an aggregate search and that occurs when getting a count of something, and from what I understand that happens via ‘do a search for:count’ and a reference to an RG list of things count
search is the search of the RG. You can even play around with some other tabs like Response to see the complete response and all of the characters returned