Is there any way to speed up a view query


I have a view…

function (doc, meta) {
emit(doc.eventKey, null);

and a java method to access it…

String designDoc = "dev_rules"; String viewName = "by_eventKey"; View view = client.getView(designDoc, viewName);

Query query = new Query();
query.setIncludeDocs(true); // Include the full document body
query.setRangeEnd(eventKey + “_!”);

ViewResponse response = null;
try {
response = client.query(view, query);
} catch (Exception e) {
Log4jNode.log(logPrefix, “DEBUG”, “**** client.query exception:” + e.getMessage());

Is there any way to speed this up? The query has from none to 20-30 hits and takes 7-20 ms and I want to trim as much as I can.




Hard to say without knowing your exact system.

But something you can do is to cache the result of your query. Something like: