Thanks Jens. I've been able to merge all existing views down to three. 1.4.1 seems to have helped significantly.
On Friday, December 1, 2017 at 4:15:04 PM UTC-5, Jens Alfke wrote: > > > > > On Nov 29, 2017, at 9:06 AM, Scott Ahten <[email protected] > <javascript:>> wrote: > > > > I'm starting to run into performance issues on a iOS 1.4 CBL app with a > very large number of documents (+30k). It seems that indexing is blocking > queries and, in turn, blocking specific tasks. > > Hopefully 1.4.1 helps — there’s a SQLite query optimizer bug that we had > to work around. > > > First, drastically reduce the number of views to reduce the amount of > indexing work. > > Also, if you have related views (that will be queried at similar times, > like by the same controller) give them names starting with a common prefix > and a slash, like “detail/byName” and “detail/byDate”. The indexer uses > that as a clue that it should index those views at the same time, i.e. if > it’s indexing one it will index the other(s) too. > > And try to optimize the code in your map block. It gets called many times, > so small time savings add up. Don’t pull the same property out of the > document dictionary twice; keep it in a local variable. Try to avoid > parsing dates. Stuff like that. > > It’s also possible to query a view without updating the index, if you’re > OK with getting stale data. > > > Second, try and keep indexes up to date by setting up a live queries, > returning only one row, that reference the remaining views. > > You can also directly update the index in the background by calling > -[CBLView updateIndexAsync:]. This will run on the background thread and db > connection that are used by the replicator. > > > When setting up a second connection, is it necessary to define > map/reduce blocks for each database connection that points to the same > file? > > Yes; any CBLDatabases on the same file need to have the same map functions > set up. > > > Also, what determines where indexing work is performed? > > Views are usually indexed lazily, when queried. If you query a view and > its index isn’t up-to-date, the indexer will run and scan the revisions > that have been added since it was last indexed. But it’s also possible to > index a view manually as I showed above. > > —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/4eeb8723-16fc-4002-a253-24a36b0d0a07%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
