Do we need to keep whole database in Couchbase Lite always, taking device performance in consideration?

Hi Team,
I have just started playing with Couchbase Lite and working on a POC to offline capability of Couchbase.
I am able to sync data from mobile device to Couchbase server using Sync Gateway, even if I created it without internet connection, so that part is fair enough.

However, I have question that sometime we may need to validate some data which is not present in CB Lite. For instance, a field bank officer goes to one of his client for making loan application where there is no internet connectivity. And now, to validate that customer he/she may need validate that customer with his bank account number (to verify- if client is an existing bank customer or not). Now as we do not have connectivity, how we can validate that customer.

One that we can think of is to keep whole customer data set in mobile device in CB Lite. But there can be a lot of customers and keeping in mobile can adversely affect device performance.

Requesting you guys to put some light on this aspect. Thanks in advance.

A few thoughts:

  • In what way are you concerned about device performance?
  • Can you structure your data to keep the minimum amount to have what is needed offline? Is that still too much?
  • Can something be done to break it down regionally, or by client list?

Seems unlikely that people in the field making physical visits would need enough data to be a problem. Have you looked at breaking down data by channels yet?

Thanks @hod.greeley for replying. I am worried about disk space of mobile device.
Up to what extent CB Lite can be extended in a mobile device? I mean what can be the maximum size of a CB Lite database that can reside inside device?

There is no limit that I’m aware of. There are techniques for controlling the size. Purging documents is a good idea if you have build up many over time that aren’t needed . Read this post for more info:

CBLite uses SQLite as its underlying data store. SQLite’s only explicit size limit is something like 2^63 bytes, i.e. much larger than any available filesystem, and people have used it for terabyte-size databases.

Thanks @jens and @hod.greeley… I hope this should not be a problematic situation to keep entire data set inside device.

You can estimate the size by looking at the size of the JSON of a typical document, adding about 200 bytes/doc for metadata and other overhead, and multiplying by the number of documents.