> On Jan 1, 2015, at 8:59 AM, Abdolhosein V. Ebrahimi <[email protected]> 
> wrote:
> 
> Is livequery performed after adding every new document?

It's called at some point after one or more new documents are added; the 
details are implementation-dependent. I don't know the details of the Java 
implementation; maybe Traun can give details. On iOS I recently optimized it so 
it won't fire more than (IIRC) twice a second.

Also, a transaction is treated as one change. So if you group a lot of updates 
into one transaction (which you should anyway for performance) the live query 
will update only once after the transaction commits.

> I have a db with a million records:
> It's somehow annoying because line A (check below) is called million times 
> after updating just a single record:

Yes, it's not efficient to run a live query that returns such a large number of 
rows.

In your case it looks like you're only interested in new (or changed) 
documents? If so, it's much more efficient to listen for DatabaseChanged 
notifications instead of re-querying the whole database.

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/C6A250C5-F822-4AEC-8E60-898FB498FB6E%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to