Database: very wide table performance? / Custom Type w/ a lot of fields

3NF isn’t a risk/concern in my app so I’ve already taken this advice :slight_smile:

I just spent the last few hours reading through this book. Wow, what a fantastic resource! I wish I had this when starting out with bubble :slight_smile: I’ll definitely be referring to it in the future.

In the book, @petter uses the term heavy data types to describe what I think I’m asking about here in this thread. i.e. Custom types with both lots of stored content as well as many different fields types full of unstructured data.

The proposed solution for faster searching through these heavy datatypes is to create light datatypes (aka satellite types) containing only the fields you wish to search and to associate the light satellite typed things to the corresponding heavy things.

While I understand the mechanics of what the premise is proposing, I’m really not exactly sure why? Is it to force whatever magical algorithm bubble uses to index these certain ‘searchable’ fields/columns inside these tightly-scoped satellite light types? Or is it to avoid a some kind of boilerplate ‘full table scan’ that bubble is doing, which is laborious for the db to process and ship and for the browser to download as @NigelG (and the book) said?

Maybe I’m overcomplicating (or over simplifying) this but I don’t understand why searching for a single or many rows in a wide table would be an expensive operation in bubble and why the satellite type would even be necessary. We aren’t talking about a computed value in these satellite light datatypes, just a clone of the same value that exists elsewhere in the heavy* type–just without sibling data.

If I have 155 columns in my type and need to display 5 of those columns in an RG times 200 things, what it sounds like bubble is doing doing is fetching all 155 columns x200 things and throwing away 150 of those columns for each row (30,000 pieces of data being fetched from the db and downloaded into the browser, but the. not shown?)

The book also seems to suggest that this doesn’t occur (as in, only the 5 columns are shipped to the browser, which appears to be in direct contradiction to the above, so I guess I’m saying which one is it?

1 Like