Database Read/Write INCREDIBLY SLOW

Hi all, I know I’m not the first to post about speed issues. When I first had speed problems, I reviewed how my workflows were made and how I was making searches to make things as simple as possible. Still it takes like 2-3 minutes to copy/delete a list of things with 48 records (each having like 5 fields). I’m on a paid personal plan.

In my app I have forms with 48 statements. The user clicks on the statement to make it true or false. That’s it.
So all there is to do is to copy a list of 48 things from templates. And if he deletes it, it deletes a list of 48 questions matching the selected survey. When the list action is triggered, the browser will be loading for like 2-3 minutes which is nuts.

I was once able to make a calculation going through 12k records in MySQL in 0.06 seconds. How can 48 simple records take so long to write??

2 Likes

@julienallard1 Personal plans do not have reserved capacity units. You can test with boost for free if adding capacity improves performance.

Hi @neerja, I already tried the boost. The delay is the same and I still get a notification in the debugger that my app could be faster with more capacity.

@julienallard1, it sounds like your approach to this isn’t optimal. Rather than musing about why you’re doing what you’re doing, I’m going to point you to my video about modeling amenities for a hospitality app — which from a data model perspective is the exact same thing as a list of questions with boolean answers.

1 Like

Thanks Keith, since the length of the video, I’ll have to wait till tonight to watch it!

Your approach to use the presence of the an item in a list as a boolean seems good. But why is there the boolean type if it isn’t optimal? Or what if every question have several inputs that aren’t all boolean (which is the case for another form)?

Bubble offers great flexibility to build apps. With that flexibility comes the responsibility to build wisely to maintain performance, I get that.
But Copying or deleting a list of 48 very simple records should not need to be simplified/optimized as it is a super basic action.

If I add repeating groups containing repeatings groups, all making searches in the database, then yes I should review the way I do things to improve performance.

The only two options I can think of right now is to use an external SQL db to put my data in and use the SQL Connector. It seems absurd, but if the external database can provide 1000% more performance?

The other option is to quit Bubble and build with something else. I really don’t want to get there because Bubble is so awesome. It’s well made, and allow to build quickly.

1 Like

woah 48 seems way too many options to ask a user, what are you trying to determine.

I understand you challenge of speed, and Bubble is working on that (too much sharing on a big database has his limitation). Once you are on a dedicated server, life is good. Have you tried to separated into api workflows the process of copying and deleting? I erased faster that way (your plan is now limited to 10 concurrents api workflow per start).

I tried to use API workflows. I makes the app look quicker, but it’s just because the actions are taking place in the background. For my case it’s no good because when the user fills a new form, it will take very long before it appears in the list of filled forms. That leads the user to confusion and frustration.

As for the speed, I tried to use boosts in the setting panel. It says that I’m supposed to get much better performances, but I didn’t see any improvement.

A few ideas:

  • For creating statements from templates, could you do that one at a time when the user answers each statement vs. all at once?
  • If not, you could use Bubble’s Bulk API functionality, which will speed things up (but won’t be instant)
  • For deleting, could you have a yes/no “Deleted” field on the Survey object, which will make it disappear and then schedule an API workflow to delete the actual statements in the background?
1 Like

I must agree with Keith. Your approach doesn’t seem optimal(for Bubble).

You are comparing Bubble with Mysql which doesn’t make sense. It’s like comparing a Ferrari with diesel fuel.

If you compared PostgreSQL(Bubble uses it) with Mysql then we could argue wich one is faster.

But Bubble is much more than a DB engine and with that comes one particular compromise: to make sure you build for Bubble if you want performance.

And even if you don’t make any mistakes with your Data Model or App Design you will find out that Bubble is not fast.

TL;DR You just need a better Bubble approach for your app.

1 Like

@vlad, the thing is that my 48 questions are divided into 7 categories to make UI cleaner. So I populate the forms with repeating groups. I haven’t found an effective way to populate a RG without using the database…

As for having a “is deleted” field sounds a good idea. I think I’ll give it a try.

@JonL, I totally agree with you comparing Bubble with MySQL does not make sense. What I’m comparing to MySQL is the speed of Bubble when writing in the database.

If my approach is that wrong, then what are the “Copy a list of things” or “Delete a list of things” for?

Don’t know to be honest :slight_smile:

I’ve never used them due to them being slow. I schedule APIs normally.

Not very helpful I know but it’s the truth.

Take into account that Bubble has changed a lot over the years for the better and some features could be considered very niche, not advisable, legacy and/or deprecated.

How do you guys find the idea of storing data in an external DB? Could it work? Is it wise?

1 Like

Have you tried the “BDK list plugin” from @gaurav so you can not touch the database until the end of your client process? Maybe an alternative but not ideal for something you expect to be fast at first.

1 Like

That makes sense, so you would just populate your RG with your template objects instead and then create the actual statement when each template object is interacted with. That’s a pretty clean way to do a survey type of application.

I think you are referring to the “Utilities (bdk)” plugin. @gaurav’s plugins look awesome, I’ll check these.

Thanks for the tip!

1 Like

Just to show how slow the database is, I made a dead simple app that shows a list of things. Each thing is consisted of a text/number/boolean field. There is a button that “Copy a list of things” where the list is the same as the list source. So every time the user clicks the button, the number of elements doubles (1, 2, 4, 8, 16…).

While copying, a spinning icon appears to show how much time it takes to simply create 8 or 16 or whatever entries in the database.
Normally the icon shouldn’t even have time to appear.

Here’s the URL:

The app is on free plan with a Boost for the next 45-50-min as of now (time of this post). Go try it out!

On my Pixel 2 XL, it looks tolerable until there’s sixteen items. Then it’s pretty painful. Deleting the list of 64 is silly long.