On Dec 18, 2015, at 8:46 AM, Martin Rybak <[email protected]<mailto:[email protected]>> wrote:
Why are view indexes only updated incrementally on demand, after a view is queried? It seems that the best time to index documents is as soon as they are changed. This is a design decision that originates with CouchDB. I could ask Damien what his reasons were, but I think the answers are that * In an append-only data store it’s more efficient to batch together multiple updates in one transaction, because each time the store is updated a lot of the internal b-tree nodes get written out. * Not all views get queried right away, and some are used less than others. By deferring the indexing you don’t pay the cost of having a view until the next time the view is used, which can be a benefit with rarely-used views. It’s worth revisiting this design, though. I know that Couchbase Server already updates views more eagerly. That way when a view is queried all it has to do is rerun the query, not index all changed documents, which can be slow. Well, for the most part you’re just pushing the slowness around. If views are updated when documents are changed, it makes all insertions & updates slower (as in typical relational database.) But I know it can make a difference in the user experience to not have the delay happen all at once when the user is waiting for a response. —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/835D8C8B-895E-4BB1-9188-06C317459540%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
