@cihangirb That’s great! Also thanks for the personal contact info I may take you up on that.
@geraldss Thanks for the tip, I’ll look into those.
Is there a place for pointers on how to create views that will speed up N1QL queries? I like N1QL because it is familiar to me, views not so much… but I get more confused when I need to figure out what views to create to speed up a particular query.
It would be nice to have a documentation page or blog post that lists various possible N1QL queries, and demonstrates the views for speeding them up. It would go in-depth as to how the Couchbase N1QL Engine picks each view it uses in its query, as well. Like I’m wondering how in the hell Couchbase knows a view is appropriate for a given N1QL query, I’m having trouble conceptualizing how that would work. It sounds like A.I. reading the source code for views or something.
For now I could use some help on a specific query. I’m currently working with this query and it takes around 55 seconds (!) to return and growing (bucket size is 25,535 items presently):
var query = N1qlQuery.fromString(
"SELECT META().id As id, UIDValidity, UID, * FROM messages AS message"
+ " WHERE message.type = \"message_header\""
+ " AND message.account = \"email@example.com\"" //@TODO
+ " ORDER BY UIDValidity DESC, UID DESC LIMIT 1000");
What are some full examples of views that would improve the speed of this query to something reasonable? Also, not only what are some examples of views that this query would utilize, but what is the ideal set of views that would be optimal for this query?