Hi, not sure I’m following everything you’re trying to do. But the basic concepts/principles I’ve used so far when structuring data are below. I’m not an expert in this stuff nor do I know the details of your project, so take the below as a download of my thinking rather than a direct recommendation…

  • In databases, joining tables are used for “many to many” relationships. I believe that what you have are all “one to many” relationships. (Side note: in Bubble, you don’t need a joining table for a many to many relationship, since you can link datatypes together and click the list checkmark which creates the many to many relationship. I’m sure there may be some reasons to use joining tables in Bubble, but I haven’t yet needed them thank goodness, because I expect they’d add complexity.)

  • In Bubble, if you were to link two datatypes together, you can link them one way (either side) or both ways. For example, let’s say one has a blog, with datatypes of Articles and Authors. For an Article, you can have Author as a field, referring to the Author datatype. Or, for an Author, you can have a field linking to the Article datatype that contains a list of all the Articles written by that Author. Or, you could link them both ways.

  • Which way you go comes down to speed vs. scale. You’ll see this argument discussed in threads on performance, including a great performance Q&A with Josh that is required reading. Scale says to have Article contain the Author. That way you could have a huge number of articles. Speed says to have Author contain the list of Articles. That’s because telling Bubble to list the Author’s articles is quicker than asking it to do a search for all the Articles written by an Author. However, Bubble says not to list too many Articles for an Author entry or you have performance issues. (Note: in that performance Q&A, Josh says that Bubble executes the search for all the Articles by an Author server side, which is pretty fast, so to not worry too much about it).

  • Database design principles also say to “normalize” your data by putting information where it belongs. So, for example, an Author may have a bio, location, etc. That info should reside in the entry for an Author, rather than duplicating it in the entry for every article the Author has written. This keeps things clean and avoids duplicating data, and if you had to update an Author’s entry, you wouldn’t have to then also update a bunch of article entries. The caveat to this with regards to Bubble is that if you need to search and filter Articles based on information in the Author entry (like, show me every article written by an Author who resides in Seattle), that may not be a fast search on Bubble since it involves two searches in your search setup: Search for all Authors in Seattle and then search for all articles written by those authors. (Note: this is where database indexing comes in, which is a whole other topic in terms of when Bubble indexes data and when).

So a key question is the extent to which scale enters the equation. For me, scale is important, so when I’m structuring all my data, I build for scale and according to database best practice, and if I run into an issue related to search speed then I deviate.

I’ve also found all the threads and discussions/arguments on these topics helpful because they tease out the different approaches and issues people are having. So, a variety of perspectives are good.

2 Likes