Realtime-Database Vs Cloud-Firestore?
Today, I was attending at Google Developer Day Extended at FYI Center in Bangkok Thailand. Thank you GDG Thailand & Jirawatee 🔥 for firebase session
Most of developers, I know so confuse and ask me the question below?
Dev: What the best choice of firebase database for my projects. Which one is better?
Me: It depends on your data relationship and how you use database. And you have to know the nature of your technology you’ll be using.
- ) It’s faster than Cloud-Firestore approximate 200–300 milliseconds.
- ) It’s been proved by lots of company that using on production.
- ) There is only 1 server in the world at California, if the server’s down then your app.
- ) It recommends Flat Data-Structure. Many times, It’s make data lots of duplication. Cause if your structure has many level of data. It affects on the performance.
- ) You can sort data only 1 field.
- ) You can query data only 1 time.
- ) Really hard to do a pagination.
- ) Not Supporting Full-Text-Search. (Firebase recommends Algolia to make this feature)
- ) It recommends Documents Data-Structure. You can keep data in many-levels with out effect the performance.
- ) Shallow Query Feature will query data without children. So, you will get only data you need.
- ) You can sort more than 1 fields and query with many conditions
- ) Store data in Multi-region. Your app will be save and if you’re using Firebase far from the us. The response time will be better.
- ) Supporting offline with no coding.
- ) It’s slower than Real-time database approximate 200–300 milliseconds. but I think it can be trade-off.
- ) It’s still be in Beta state, but some companys are using even if Beta State.
- ) Not Supporting Full-Text-Search. (Firebase recommends Algolia to build search feature).
- ) You READ/WRITE lots of data, Firebase Cloud-Firestore’s cost will be so expensive. Realtime database doesn’t care when you READ/WRITE Data such as Drawing picture apps.
- ) Your data has no relationship.
I recommend you using Cloud-Firestore. If your app doesn’t have any condition above. and you’ll get more convenience when using with Cloud-Function. It’s so amazing.
- ) https://firebase.google.com/docs/firestore/
- ) https://firebase.google.com/docs/database
- ) https://firebase.google.com/docs/functions/
- ) https://firebase.google.com/docs/firestore/extend-with-functions
- ) https://stories.sellsuki.co.th/cloud-firestore-%E0%B8%84%E0%B8%B8%E0%B8%93%E0%B8%84%E0%B9%88%E0%B8%B2%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%84%E0%B8%B8%E0%B8%93%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%84%E0%B8%A7%E0%B8%A3-b471d9b926e3