What is the best way to store 1 million record?

We have a usecase where we need to store 1 million record offline. What is the best way to deal with it?

Querying data is important. Query should be faster.

I would suggest SQLite for that use case, but with the native plugin and not with ionic storage:

But I never managed that many records offline, so you have to try if it is fast enough for you. I don’t know your use case but you should be aware of the disk space on mobile devices. The ionic native file plugin can read free disk space so you can check if there is enough space for your offline records.

1 Like

Thank you @Nexi, this info will help a lot. Why not ionic storage? What is your view about pouchDB using cordova-sqlite-plugin?

You can use pouchDB, too. But don’t save your records with it in browsers db. Install a plugin that uses a real database for performance reasons. Here is a quote from pouchdb.com

For mobile applications, you can use PouchDB within PhoneGap/Cordova (optionally using the SQLite Plugin), or there are several native libraries:

Couchbase Lite for iOS
Cloudant Sync for iOS

Couchbase Lite for Android
Cloudant Sync for Android

If your records structure fits a key/value store, you can use ionic storage, too. But I think pouchDB or directly accessing sqlite can be much more performant.

1 Like