PouchDB with Ionic 3 - Which storage system should I use?

From Ionic doc:
"When running in a native app context, Storage will prioritize using SQLite, as it’s one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations."

From PouchDB doc:
"We recommend avoiding Cordova SQLite unless you are hitting the 50MB storage limit in iOS, you require native or preloaded access to the database files, or there’s some other reason to go native. The built-in IndexedDB and WebSQL adapters are nearly always more performant and stable."

It seems that there is a conflict of informations there.

Hey Yury, not sure if it is a conflict. Those statements are done on a very broad scope/scale and when it comes to a specific project - you can decide what works best for you.
Personally I tried both, both have some issues and pretty good support. In my case I chose localForage (Ionic Storage) simply cause its part of Ionic offering and working with it proved to be successful.

Always go indexedDB over LocalStorage. It is async and has more storage capacity.

@yuricamara Hello, I haven’t tested PouchDB yet, but this is in my todo list. And as you mentioned, local storage is only for small bytes.

And yes they both conflict, looks like they never put something in production :stuck_out_tongue:
(indexedDB is so slow)

Personally I tried both, both have some issues

. What issues did you have?


  1. Ionic Storage:
  • very simple get/set API
  • configurable, adapters etc
  • part of Ionic offering, which hopefully means good support
  • small size (8kb?)
  • almost no control over db, not sure you can index data etc
  • syncing data with server needs custom code (we wrote it)
  • no bulk type operations (does have .forEach method though)
  • supports storage of blobs but not as attachments, both dbs have issues with binary data I think. We saw some behaviors and super hard to triage issues when we stored binaries locally. Once we removed those - issues were gone…
  1. PouchDB
  • nice syncing mechanism with other couchDB (although couchDB is considered to be slow, for lazy replication its good)
  • bulk operations, built-in conflict resolution
  • extensive API, you can do a lot of things, indexes etc
  • more complex API to work with. For a put you almost always need to read document and use its revision to store it back etc
  • basically complexity led to more bugs in our case.
1 Like

Thank you for this list!

I use MongoDB instead of CouchDB. So, no sync with PouchDB.
In my case, which one would you choose?

We actually had Mongo that we started with. And it worked ok. Problem is we have to have “transactions” and Mongo has a solution but not native one, so we switched to PostGres.

As for Mongo - it was OK and we ran in no problem with it. But yes since we had no sync feature we already decided to evaluate migrating to Ionic Storage. Now we live with the latter and its doing its job great (for now)

1 Like

@morphist And I considered too Ionic Storage until they said it was deleted, one day.

@morphist Now I rely on Google database, and it’s worth the cost.

Have fun with ionic :slight_smile:

@morphist I’m also one of the first ionic users to actually make SMS plugin work. Have fun :slight_smile:

@FrancoisIonic Heey;) can you elaborate a bit more what do you mean by “it was deleted”?
as a project it exists right? do you mean it is not reliable as a browser based storage or?

Also eager to learn what exactly do you call Google Database:)

1 Like

I think he meant Google Cloud Platform.

Emmm its like saying “internet”:slight_smile: google cloud platform has 30+ offerings so I was interested to learn what was mentioned as equivalent to pouchDB/Storage

Well there’s only the SQL, Big Data and their NoSQL (forget what it’s called) database engines.

Why not use LokiJS with Storage? It works great in tandem, it’s what I did with my app and hadn’t had problems. I haven’t tried syncing with a server side database but I will be trying to do that when I move my app to the cloud server next week/month.

Chime in once you tried;) I am still puzzled with what Francious mentioned as “it was deleted”. Ionic Storage works perfectly for me. Yes it has no server side persistence, but I am free to use whatever I want.

1 Like