I would say that ideally in Firebase you only read or sync what you need. . Thus, your database queries are linked to other filters to make the query as specific as possible. If you can nail this, then you will still create a very intelligent data structure that will be cost-effective.
Now the real discussion is Fan-Out Technology or just send a link to the nodes . As I personally prefer Fan-Out, and also use it successfully , so I will only answer this technique, which will also give you an indication of the reason why I do not want to use the link and thatβs it.
- First of all, it is the experience and performance of end users. What happens in the form of a Charge Data Chunk Sync . In general, this means that instead of downloading small pieces, you are aimed at the maximum possible to reduce the use of High Cell , High Battery Drain , High Bandwidth radio communications , and update and synchronize the application as quickly as possible .
If you are aiming for such application performance, then you clearly see that Fan-Out is a winner by a different technique for the following reasons.
- You are loading a large block of data stored in another node, which prevents your cellular radio from staying for long.
- When you download all the information at once, your application works better than others. Obviously, in general, I do not want you to download the complete database. All about this smart balance, which forces you to download only what is required in the first place.
- This is not that it is the only method that will give you a faster read and better data structure. There are other methods, such as indexing, data validation, and security rules , which are equally important. Everything correctly connected to the right data structure will give you much better performance.
- In a situation where you have only a link to other nodes, and not the actual data , you may find yourself in a situation where you actually have nothing to show to your users, Let's say your users do not get a good connection , so after one reading, which gave you only a link, the network crashes . Thus, until the network is back up , your users do not see anything and trust me that this is a very bad situation for the application. Your goal as a developer should be to reduce the chances of these situations.
So, I would recommend you switch to the FAN-OUT technique , because it is faster and more economical when you see other factors, such as data filtering, indexing and security rules, as well as strong>. Yes, this is due to the low cost of high storage utilization. But what does smaller storage mean when you don't have happy users? Nevertheless, it comes down to personal preference. But I shared my experience and thoughts, hoping that this will help you make the right decision.
I would advise you to go through this and a deeper understanding of SQL Data modeling strong>
Let me know if this information has helped you.
source share