Using the Index in Phoenix

Apache Phoenix automatically uses indexes to service a query. Phoenix supports global and local indexes. Each is useful in specific scenarios and has its own performance characteristics.

Global indexes in Phoenix

You can use global indexes for READ-heavy use cases. Each global index is stored in its own table and thus is not co-located with the data table. With global indexes, you can disperse the READ load between the main and secondary index table on different RegionServers serving different sets of access patterns. A Global index is a covered index. It is used for queries only when all columns in that query are included in that index.

Local indexes in Phoenix

You can use local indexes for WRITE-heavy use cases. Each local index is stored within the data table. With global indexes, you can use local indexes even when all columns referenced in a query are not contained in the index.

This is done by default for local indexes because the table and index data reside on the same region server and hence it ensures that the lookup is local.