Recently I come across with lokijs and I am planning to use it for my hybrid mobile app developed using Ionic. From my understanding, it is an in-memory database that will executes very fast. So, my questions is, will it work great with big database (maybe around 10-50MB or even more)? Does working with big database using lokijs will dramatically slow down the app?
Asked
Active
Viewed 1,987 times
4
-
The important thing is, that lokijs is a NoSQL storage. If this matches your needs, then it is okay, otherwise I would choose this plugin: https://www.npmjs.com/package/cordova-sqlite-storage – Joerg Nov 16 '15 at 06:58
1 Answers
3
The only operation that may result in a dramatic slow down is the periodic save of the db, as at the moment LokiJS does not support incremental saves, so the whole db is serialized. Beware of size limits when working with IndexedDB or localStorage, if you need unlimited resources then an fs adapter like lokijs-cordova-fs-adapter will do the trick. Retrieval of documents even on large dbs, if properly indexed, should be still very fast.

Joe Minichino
- 2,793
- 20
- 20
-
Thanks a lot for your answer. So, is that mean if my database file is 50MB file size, whenever there is a little changes to the record, it will need to resave the whole file again? How 'bout SQLite? Does it saving and retrieving large database file faster? – user1995781 Nov 18 '15 at 01:03
-
not sure about SQLite, I wrote LokiJS so I'm familiar with its internals, not SQLite i'm afraid :) – Joe Minichino Nov 18 '15 at 20:43
-
1Wow... Didn't realize that the author is answering my question!! Overall LokiJS looks awesome and I was planning to use it for my app. But my main concern is about saving & reading large database. If LokiJS is really rewrite the whole file, then I guess it will be huge performance issue. Hope LokiJS can improve on it in future release. – user1995781 Nov 19 '15 at 06:00
-
2
-
2I realize this is an old thread, but I can't find anything on the Loki site saying whether the incremental save problem has been fixed. Has it? Thanks. – TimTheEnchanter Apr 27 '17 at 04:34