Just starting to explore Firestore storage and first thing to do - read a simple small document in my Android app by document key (authenticated with Google, but probably th
These get()
requests are reading the data from the Cloud Firestore backend, over the network, so they'll necessarily be much slower than SQLite which is just reading locally from disk. The first read is also likely to be slower than subsequent ones since it has to initiate the network channel to the backend. We'll look at improving performance over time, but you can't expect 0 ms if you're retrieving data over the network.
You may want to enable offline persistence which would enable local caching of data you've previously read. Note though that get()
calls will still try to hit the network first to give you as up-to-date data as possible. If you use addSnapshotListener()
instead, we'll call you immediately with the cached data, without waiting for the network.