Bubble, Postgres, Performance

I was reading this post A fair and honest chat about Performance and got the distinct feeling that bubble is not storing our data in vanilla database tables?
I am now fascinated by how bubble is architected around its arguably single most performance intensive component, i.e. the database. The performance issues faced by users in that post seem at odds with my personal experience with Postgres. So my conjecture is that Bubble stores user data in hstore or jsonb, and that results in the absence of column stats / proper indexes. Does anyone have confirmation or otherwise?
Thanks!

2 Likes

So I read a few more posts regarding performance and came to the conclusion that bubble has done a lot behind the scenes for backend performance, though I am not clear on how bubble does certain things lol, probably their trade secret at this point.
It seems like bubble started off with elasticsearch, and due to its lack of transactional support and the cost of maintaining a consistency layer, the engineers decided to move to Postgres, and with that they enforced the 1k column limit (I think postgres has 1.6k as limit) and moved all tables with more than 1k fields into some kind of JSONB column (together with the backward-compatibility code?).
The way bubble stores references appears to be one-way, not sure if it uses actual foreign key though, my bet is probably no. The references seem to be stored as text fields?
It also seems that bubble automatically builds index on postgres, probably by analyzing pg_stat_statements?
Regarding performance, I wonder why each request takes at least 100ms? I’m talking about requests like msearch.
Also, the mechanism through which bubble achieves “live” query seems very intriguing. It appears that through the call to bulk_watch, the front end establishes some kind of “watch” on db. If a matching record is changed, the backend would send back a notification through a WS connection established on page load. That then triggers a new call to msearch. Very clever stuff. I wonder if this entire process is done using LISTEN/NOTIFY or entirely in the application layer?
Not sure what language / framework bubble uses for backend server though. Does anyone have an idea?

3 Likes

@josh as the god of bubble architecture, could you comment on my theories?

I hope someone from the bubble architecture software team replies to you

1 Like