le to around 200,000 concurrent connections and 1,000 writes/second in a single database. Scaling beyond that requires sharding your data across multiple databases. 
  * No local limits on write rates to individual pieces of data. 

  
  
###  Security

Cloud Firestore  Preferred  |  Realtime Database   
---|---  
**Non-cascading rules that combine authorization and validation.**

  * Reads and writes from mobile SDKs secured by [ Cloud Firestore Security Rules ](/docs/firestore/security/get-started) . 
  * Reads and writes from server SDKs secured by [ Identity and Access Management (IAM) ](https://cloud.google.com/firestore/docs/security/iam) . 
  * Rules don't cascade unless you use a wildcard. 
  * Rules can constrain queries: If a query's results might contain data the user doesn't have access to, the entire query fails. 

|  **Cascading rules language that separates authorization and validation.**

  * Reads and writes from mobile SDKs secured by [ Realtime Database Security Rules ](/docs/database/security) . 
  * Read and write rules cascade. 
  * You [ validate data ](/docs/database/security/securing-data#validating_data) separately using the ` validate ` rule. 

  
  
###  Pricing

Both solutions are available on the [ Spark and Blaze pricing plans
](/pricing) .

Cloud Firestore  Preferred  |  Realtime Database   
---|---  
Charges primarily on **operations performed in your database (read, write, delete)** and, at a lower rate, bandwidth and storage.  Cloud Firestore supports daily [ spending limits ](https://cloud.google.com/appengine/docs/standard/python/console/#setting_a_spending_limit) for App Engine projects, to make sure you don't go over the costs you're comfortable with.  Read more about [ Cloud Firestore pricing plans ](/docs/firestore/pricing) .  |  Charges only for **bandwidth and storage** , but at a higher rate.  Read more about [ Realtime Database pricing plans ](/pricing) .   
  
##  Using Cloud Firestore and Realtime Database

You can use both databases within the same Firebase app or project. Both NoSQL
databases can store the same types of data and the client libraries work in a
similar manner. Keep in mind the differences outlined previously if you decide
to [ use both databases in your app ](/docs/firestore/firestore-for-rtdb) .

Learn more about the features available in both [ Realtime Database
](/docs/database) and [ Cloud Firestore ](/docs/firestore) .

##  Ready to choose a database?

Hopefully this comparison has helped you settle on a Firebase database
solution. Now you can learn how to add a database to your Firebase projects.

  * For **Cloud Firestore** , take a look at [ Get started with Cloud Firestore ](/docs/firestore/quickstart) . 
  * For **Realtime Database** , read the Get Started topic for your platform: [ Apple ](/docs/database/ios/start) , [ Android ](/docs/database/android/start) , [ C++ ](/docs/database/cpp/start) , [ Unity ](/docs/database/unity/start) , [ Web ](/docs/database/web/start) , or [ REST ](/docs/database/rest/start) . 

Send feedback

Except as otherwise noted, the content of this page is licensed under the [
Creative Commons Attribution 4.0 License
](https://creativecommons.org/licenses/by/4.0/) , and code samples are
licensed under the [ Apache 2.0 License
](https://www.apache.org/licenses/LICENSE-2.0) . For details, see the [ Google
Developers Site Policies ](https://developers.google.com/site-policies) . Java
is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-04-17 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing
the information I need" },{ "type": "thumb-down", "id":
"tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{
"type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type":
"thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{
"type": "thumb-down", "id": "otherDown", "label":"Other" }]  [{ "type":
"thumb-up", "id": "easyToUnderstand