-
Notifications
You must be signed in to change notification settings - Fork 25
Firebase / no firebase or how can we use the firestore as a relational database? #275
Comments
I think one very important reason to have chosen this platform is the offline capabilities. Just as to make the discussion as wide as possible: what if we let this feature go and help users finding hardware based solutions (mobile wifi points, extenders) or even let them work on a local box. |
Not sure if this is the solution you're looking for. |
Even if we solve the problem with the query syntax using some abstraction layer over it, we'll still have problems with the number of reads/writes on it. Firebase don't have a join syntax integrated to the get() method yet, and they don't plan to have it (I've can't find now the thread where the firebase team responded this). With a setup like this we'll be free ourselves from a vendor lock, something that Google is an expert doing, and being able to move to any service with the node+postgres 👍 For offline mode, for now, we should go KISS by just precaching data on the app state and dump this information on something simple as localstorage or so, and only when the necessity appears, try to move to a indexedDB wrapper or any more robust solution. UPDATE: |
For not having to maintain complex backend we can try out something as: It seem to have even a way to deploy directly to heroku 🤔 |
I just had an interesting read on medium. He describes a similar solution to ours and proposes to use firebase and pouchdb parallel. What do you think of that? |
Even if we use both, we'll need at least a minimum backend to communicate with both services to deal with the authentication problem. 🤔 |
We had a discussion about this issue on skype yesterday (c.f. meeting minutes). Some guidelines how this will work (#290) and a first example (#289) will be produced. |
Firebase has many advantages. It is taking care of the authentication and is a great hosting service. We will spend much less time on maintaining a backend and firebase could be a great tool when we want to add offline support (#28), too.
However, our data model is relational and the firestore is a noSQL-database. Currently, we are implementing queries in a very inefficient and complicated way. We are nesting queries (c.f. #227) or BoxListContainer
Such queries multiply the number of reads.
Example:
Our first tester has about 20 products and registered about 20 boxes in total. If our user wants to see an overview over all boxes with each of them showing their product name, we would need in the order of 40 reads if we use a relational database. As it is implemented above we need about 400 reads.
It did not matter until now because we do not have much data and only queries with one JOIN.
However, the next features (#178 or #190) already require more advanced queries including aggregation, more JOINS, ... We are also thinking to offer something like labels (like in github) to tag different boxes. Such tags would require to model even a N-to-N relationship.
So, in the long run it does matter. The pricing of firebase is based on the reads and writes and it will slow down each query if we keep on nesting our queries. Most important it will be annoying to implement the queries as nested queries.
==> We need to decide (now) how to do queries in general.
possible solutions:
PS. We had this topic partly already before in #73.
The text was updated successfully, but these errors were encountered: