Hello!
I’m developing and app for both android and iPhone using CBLite and I’m currently struggling with an issue on the Android app.
What happens is that couchbase lib takes a lot of time to save and update documents when the local database already has a couple hundreds of documents.
This happens when I save properties on my document and on those properties I include the field that I also use to filter documents on my view’s map function.
I get the sense that some sort of re-indexing is being made when I add/update a document.
Do you have any tip so I can bypass this slow performance issue? I’ve tried to not include that particular field on the update operation but then the listener that I have on the databse does not pick the change and I really need that in order to update the UI.
Many thanks!
Cheers
Rui
Hi @ruimagalhaes,
I believe a couple hundreds of documents are not a lot. It is reasonable size. From current information, I don’t know what cause the slowness. Could you please provide CBL version, Android platform information, Map function, and sample document. Also could you please provide how slow it is?
Thanks!
Hello @hideki
I’m using the latest CBL version.
My map function goes like this:
view.setMap(new Mapper() { @Override public void map(Map<String, Object> document, Emitter emitter) { if (document.get("DOC_TYPE").toString().equals("JOB")){ if(document.get(Job.KEY_IS_DELETED) != null){ emitter.emit(document.get("TITLE"),null); } } } }, view_version);
then when I use that DOC_TYPE
property on the map object that I use to update or save a document CBL take several seconds to perform the operation. If I do not include that property, even if I’m just updating the document, my database listener doesn’t get the change so I suspect that the database is being indexed when I modify documents.
Am I right about this? It yes, why is this taking so long?
Thanks!
Hi @ruimagalhaes,
Your map function is simple. Slowness does not come from the map function.
With current information, I don’t know what cause the slowness.
Could you provide us sample app that we can debug? or can you do profiling?
Thanks,