Chapter 6. Performance planning for application developers 135
All composite indexes must have the RangeIndex property set to false.
All association (relationship) indexes must have the RangeIndex property set to false.
An alternative to indexes with much better scalability and performance (at the price of having
custom code) is the reverse index pattern, which is described in 5.4.4, “Indexing plug-ins” on
6.5.3 Using pagination
In client-server environments, the query engine transports the entire result map to the client.
The data that is returned must be divided into reasonable chunks. The EntityManager Query
and ObjectMap ObjectQuery interfaces both support the setFirstResult and setMaxResults
methods that allow the query to return a subset of the results.
6.5.4 Returning primitive values instead of entities
With the EntityManager Query API, entities are returned as query parameters. The query
engine currently returns the keys for these entities to the client. When the client iterates over
these entities using the Iterator from the getResultIterator method, each entity is automatically
inflated and managed as though it were created with the find method on the EntityManager
built from the entity ObjectMap on the client. The entity value attributes and any related
entities are eagerly resolved.
To avoid building the costly graph, modify the query to return the individual attributes with path
navigation, for example:
// Returns an entity
SELECT u FROM User u
// Returns attributes
SELECT u.userId, u.firstName, u.lastName, FROM User u
6.5.5 Query plan
All WebSphere eXtreme Scale queries have a query plan. The plan describes how the query
engine interacts with object maps and indexes. Display the query plan to determine if the
query string or indexes are being used appropriately. You can also use the query plan to
explore the differences that subtle changes in a query string make in the way that WebSphere
eXtreme Scale runs a query.
The query plan can be viewed in one of two ways:
EntityManager Query or ObjectQuery getPlan API method
ObjectGrid diagnostic trace
6.5.6 getPlan method
The getPlan method on the ObjectQuery and Query interfaces returns a string that describes
the query plan. This string can be displayed to standard output or a log to display a query
Distributed environment note: In a distributed environment, the getPlan method does not
run against the server and does not reflect any defined indexes. To view the plan, use an
agent to view the plan on the server.