tree: 11684bfce0cd2f6047ce1b177c4d7b9b51b4e40a [path history] [tgz]
  1. scripts/
  2. src/
  3. README.md
indexes/README.md

Geode OQL Indexing Example

This example demonstrates an index for OQL queries on a region.

A region can contain objects of arbitrary complexity, including objects that contain other objects. The values of a region can be queried using OQL and OQL queries can reference fields in the objects in the region. Indexes can be created to improve the performance of queries. Certain optimizations occur for top-level fields but indexes can also be created for nested fields, i.e., fields of objects that are contained with the objects in the region.

This example uses a mock database of passengers and flights stored in a single region. Since the region contains passenger objects, the index on passenger name uses a top-level field. Since flight code objects are contained within a passenger object, the index on airline code uses a nested field. After randomly populating the mock database, this example shows the results of queries that use no index, a top-level index, and a nested index.

This example assumes that Java and Geode are installed.

Steps

  1. From the geode-examples/indexes directory, build the example and run unit tests.

     $ ../gradlew build
    
  2. Next start the locator and two servers.

     $ gfsh run --file=scripts/start.gfsh
    
  3. Run the example to create indexes in the region.

     $ ../gradlew run
    
  4. Shut down the system.

     $ gfsh run --file=scripts/stop.gfsh