I would like to open a discussion about what is the best practice to use the query on an android application and evaluate several aspect in term of performance.
In the example the query is built on the fly then executed it,
There is any impact on the performance creating the query every time, or is it better save it in a singleton object and reuse it every time? What if I have a to attach a listener to a query (old live query 1.4)?
In our mobile application we use to attach to every document a listener, this because the code is been migrating from couchbase lite 1.4 to 2.5 and we might have thousand of documents.
Now the new library does not allow to attach listener to the document itself, but on the database, to a particular document id [addDocumentChangeListener] but now there is also the listener to the whole database [addChangeListener]
What is the best practice to deal with this kind of issue? Having thousand of document which approach give the best performance?
Thanks for any feedback, I would like to have your opinion and if you had the same kind of issues in your projects.