Forum Academy Marketplace Showcase Pricing Features

Are very interconnected databases a terrible idea?

I have been working on my app for several months and my database is highly interconnected. Data types are connected to eachother. Lists of datatypes are often a field in a datatype. Some of these connections can span 3-4 layers.
I just realised when playing around with the inspect tool that the browser downloads all of these interconnections! A do a search for for a couple of things will retrieve thousands in the inspector! Is this only a feature of the inspector? Or does the browser download all the things. When i read the book “The ultimate guide to bubble performance” i remember reading something similar to this but this feels ridiculous! How do i connect datathings if everything is downloaded?

Do you have any privacy rules in place, or are those many records of data supposed to be visible to the end user as they browse the page?

1 Like

They are not sensitive data, i haven’t fully set up privacy issues, im planning on doing that at a later stage. I am more worried about performance and page loading time, especially if the live database scales. Can privacy rules also be used for performance improvement? Because there are lot of instances where downloading those fields just doesnt add anything.
Thanks

Adding privacy settings will prevent those adding records that needn’t be shown to be loaded into the browser in the first place, naturally important for both security and performance, as in your case.
Maybe your expressions need to be more streamlined too, such as adding in constraints when ‘doing a search’ for data so you only search through data that you need.

1 Like

Hi – hopefully the below gives you some clarity…

As to the question “are very interconnected databases a terrible idea” – the answer is “no”. Relationships are the foundation of modern database design (thus the term “relational databases”). They have many advantages in making databases faster, lighter and more functional. But when you create relationships, you need to do them for the right reasons and set them up in the right way.

The inspector is showing what the browser downloads onto the page.

Everything is not automatically downloaded. Something else is going on, most likely with one of your searches. Basic concepts are:

  • If a “thing” is downloaded (ie an item in the database), Bubble will download the data from each field for that specific thing, unless you’ve blocked specific fields via privacy settings.
  • If a thing has a field that is a list of things of another datatype, it will download the IDs of the related things – not the data from the things themselves.
  • Bubble only downloads the “things” that you are asking for. So most likely you have searches that are asking for thousands of things. This usually results from:
    a) A repeating group that is set up to call all results if no constraints exist (use a scrolling RG instead, which will only pull a few items at a time)
    b) A :filter that is executing client side, meaning that Bubble has to first download the things to the browser, and then filter them there, instead of filtering them on Bubble’s side and only sending the results to the browser

It’s great that you are reading @petter book – that’s essential. Also this is a great post to read on options for connecting data: Alternative approach to the Bubble’s recent tutorials for list of things

And this post from Josh is a bit old, but still has a lot of relevant stuff in it: Performance Q&A guide

5 Likes

I strongly encourage you to build a Data Model. You may be complicating the data relationships that you described. Google will introduce you to some excellent tutorials that describe Normalizing data. Just google Introduction to Data Modeling. I highly recommend a 55-minute video titled: Data modeling - an Introduction by Niels Henrik Juul Hansen. Best wishes.

2 Likes