Views and Indexes?



What are the differences between views and indexes? I have read that views use indexes. So what are the benefits of using views when indexes can do the work? I know that we use N1QL to create indexes (primary and secondary) and we use java script to create views … but I don’t understand the logic in doing views and indexes…



Hi @couchbwiss,
When to use Index vs Views mostly depends on your usage and how you would like to scale.
Views are scaled with the data service and Index can be scaled independently from your data services.

Here is a link to Cihan’s presentation about performance tuning, slide 16 shows a “when to use what” overview.

I hope this helps on clarification.