Global Secondary Indexes Versus Views
There are a number of differences between views and GSIs. At a high level, GSIs are built for N1QL queries, which are great for supporting interactive applications that require fast response times. Views, on the other hand, provide sophisticated user defined functions to provide great flexibility in indexing. Views can support complex interactive reporting queries with a precalculated result.
|Scaling model||GSIs are part of the index service. Using the new multidimensional scaling capabilities, you (as an administrator) can choose to deploy indexes on hardware that is tuned for indexing.||Views are scaled with the data service and thus cannot be independently scaled.|
|Performance characteristics||N1QL queries that require singleton lookups or range scans can process scans on GSI without scatter-gather operations if the relevant indexes are available for the query.||Views are partitioned based on data distribution and document keys, thus requiring scatter-gather operations for the same type of queries. Network based processing can be more expensive than local in-memory processing because scatter-gather operations are generally much slower. As the node count of the cluster increases, views require a wider fan-out and hence a more network based processing.|
|Managed cache||GSIs come with a managed cache that can provide higher performance during index maintenance and index scans.||Views depend on the file system cache and can be impacted by fluctuations in the underlying operating system.|
Note: For more information on the differences between Couchstore and ForestDB, see "Couchstore versus ForestDB" under Storage Architecture.
|GSIs use ForestDB for storage. Starting version 5.0, the default storage for GSIs in the Enterprise Edition is Plasma.||Views use Couchstore for storage.|
|High availability||GSIs require multiple indexes with identical definitions to be manually placed on multiple nodes.||Views provide built-in replicas with smart placement.|