I have a view with the following map function:

self.viewReservation = [_database viewNamed: @"reservation"];
[self.viewReservation setMapBlock: MAPBLOCK({
  if ([doc[@"doctype"] isEqualToStringCaseInsensitive: "reservation"]) {
    id date = doc[@"startsOn"];
    if (date) emit(date, nil);
    }
  }) version: @"5.0"];

When a reservation (i.e. document with doctype='reservation') is updated, 
with the field 'startsOn' remaining unchanged, a very large number (100's) 
of queries are executed by Couchbase, taking up a considerable amount of 
time:

2018-02-03 17:44:33.560334+0100 Nappkin[964:899162] Couch Query: 
CBLQuery[reservation]: running...
2018-02-03 17:44:33.561043+0100 Nappkin[964:899162] Couch View: Checking 
indexes of (reservation) for reservation
2018-02-03 17:44:33.562430+0100 Nappkin[964:899162] Couch View: Updating 
indexes of (reservation) from #356 to #357 ...
2018-02-03 17:44:33.564358+0100 Nappkin[964:899162] Couch View: ...Finished 
re-indexing (reservation) to #357 (deleted 1, added 1)
2018-02-03 17:44:33.566567+0100 Nappkin[964:899162] Couch Query: Query 
reservation: SELECT key, value, docid, revs.sequence, revid, json FROM 
'maps_14', revs, docs WHERE 1 AND key >= ? AND key <= ? AND revs.sequence = 
'maps_14'.sequence AND docs.doc_id = revs.doc_id ORDER BY key, docid LIMIT 
? OFFSET ?
Arguments: (
    <22323031 382d3032 2d303354 30303a30 303a3030 2b303130 3022>,
    <22323031 382d3032 2d303454 30303a30 303a3030 2b303130 3022>,
    "-1",
    0
)
2018-02-03 17:44:33.568991+0100 Nappkin[964:899162] Couch Query: Query 
reservation: Returning iterator
2018-02-03 17:44:33.583188+0100 Nappkin[964:899162] Couch Query: 
CBLQuery[reservation]: running...
2018-02-03 17:44:33.584727+0100 Nappkin[964:899162] Couch View: Checking 
indexes of (reservation) for reservation
2018-02-03 17:44:33.585985+0100 Nappkin[964:899162] Couch Query: Query 
reservation: SELECT key, value, docid, revs.sequence, revid, json FROM 
'maps_14', revs, docs WHERE 1 AND key >= ? AND key <= ? AND revs.sequence = 
'maps_14'.sequence AND docs.doc_id = revs.doc_id ORDER BY key, docid LIMIT 
? OFFSET ?
Arguments: (
    <22323031 382d3032 2d303354 30303a30 303a3030 2b303130 3022>,
    <22323031 382d3032 2d303454 30303a30 303a3030 2b303130 3022>,
    "-1",
    0
)
[etc...]

What is causing these queries? 

Thanks,
Willem
(Couchbase-lite 1.4.1)

-- 
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/b903fbb4-f61c-40da-ac82-3e9faa89ccd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to