title: Firebase Realtime Database vs Cloud Firestore
body: <p><strong>Edit:</strong> After posting the question I thought I could also make this post a quick reference for those of you needs a quick peek at some of the differences between these two technologies which might help you decide on one of them eventually. I will be editing this question and adding more info as I learn more.</p>
  
  <p>I have decided to use firebase for the backend of my project. For firestore is says "the next generation of the realtime database". Now I am trying to decide which way to go. Realtime database or cloud firestore?</p>
  
  <p><strong>Billing:</strong></p>
  
  <p>At a first glance, it looks like firestore charges per number of results returned, number of reads, number of writes/updates etc. Real-time database charges based on the data transmitted. The number of read-write operations is irrelevant. They both also charge on the data stored on the google servers too (I think in this respect firestore is cheaper one). Why am I mentioning this price point? Because from my point of view, although it might a lower weight, it is also a point to consider while choosing the one over the other. </p>
  
  <p><strong>Scaling:</strong></p>
  
  <p>Cloudstore seems to scale horizontally seamlessly. I think this is not possible with the real-time database. </p>
  
  <p><strong>Edit:</strong>
  In the real-time database, you need to shard your data yourself using multiple databases. And you can only do this if you are in BLAZE pracing plan. 
  ref: <a href="https://firebase.google.com/docs/database/usage/sharding" rel="nofollow noreferrer">https://firebase.google.com/docs/database/usage/sharding</a></p>
  
  <p><strong>Performance &amp; Indexing:</strong></p>
  
  <p>Another thing is the real-time database data structure is different in both. The real-time database stores the data as a JSON object in any way we structure them. Firestore structures the data as collections and documents. And hence the querying also changes between the two.</p>
  
  <p>I think firestore does auto indexing which increases the read performance greatly too (which will decrease read performance). I am not sure if this is also the case with the real-time database.</p>
  
  <p><strong>Edit:</strong>
  The real-time database does not automatically index your data. You need to do it yourself after a solid inspection of your data and your needs.
  ref:<a href="https://firebase.google.com/docs/database/security/indexing-data" rel="nofollow noreferrer">https://firebase.google.com/docs/database/security/indexing-data</a></p>
  
  <p>What other differences can you think of? </p>
  
  <p>What would be (or has been) your choice for different types of projects?</p>
  
  <p>Do you still go with the real-time database or have you migrated from that to the firestore? If so why?</p>
  
  <p>And one last thing. How would you compare the SDKs of these two?</p>
  
  <p>Thanks a lot!</p>