[New Feature] Smarter query optimization for "merged with" and "intersects"

Hi all – we released a performance improvement that could have a large impact on apps that rely heavily on “merged with” and “intersects” to combine searches. Previously, Bubble was unable to send a merged query to our database, so any operation that requires accessing the entire set of merged search results, such as sorting the combined list, or calculating the total length, required Bubble to query for all the data for all searches.

We now have the capability of combining merged searches into a single search, so operations such as counting the length can be done entirely database-side, which is much faster. This only affects situations where we could do either of the merged or intersected searches entirely in the database (so it won’t work on an item’s list of things, or advanced filtering).

For instance, this example query to count the number of users who are either customers or have logged in in the last week used to be extremely inefficient for large numbers of users:

“Search for Users (where ‘user type’ equals ‘customer’) :merged with Search for Users (where ‘last login date’ > Current Date / Time - 7 days) : count”

…but should now be much faster


Thanks for the update

1 Like

This is fantastic - thanks guys!