Skip Headers

# Read Optimization Examples

Previous

Next

TopLink provides the read optimization features listed in Table: Read Optimization Features.

This section includes the following read optimization examples:

- Reading Case 1: Displaying Names in a List

- Reading Case 2: Batch Reading Objects

- Reading Case 3: Using Complex Custom SQL Queries

- Reading Case 4: Using View Objects

- Reading Case 5: Inheritance Views

Read Optimization Features

Feature | Function | Performance Technique
--- | --- | ---
Unit of Work | Tracks object changes within the Unit of Work. | To minimize the amount of tracking required, registers only those objects that will change. For more information, see Understanding TopLink Transactions.
Indirection | Uses indirection objects to defer the loading and processing of relationships. | Provides a major performance benefit. It allows database access to be optimized and allows TopLink to internally make several optimizations in caching and unit of work.
Soft cache, weak identity map | Offers client-side caching for objects read from database, and drops objects from the cache when memory becomes low. | Reduces database calls and improves memory performance. For more information, see "Cache Type and Object Identity".
Weak identity map | Offers client-side caching for objects. | Reduces database access and maintains a cache of all referenced objects. For more information, see "Cache Type and Object Identity".
Batch reading and joining | Reduces database access by batching many queries into a single query that reads more data. | Dramatically reduces the number of database accesses required to perform a read query. For more information, see "Using Batch Reading" and "Using Join Reading".
Partial object reading and fetch groups. | Allows reading of a subset of a result set of the object's attributes. | Reduces the amount of data read from the database. For more information, see "Partial Object Queries". For more information about fetch groups, see "Fetch Groups".
Report query | Similar to partial object reading, but returns only the data instead of the objects. | Supports complex reporting functions such as aggregation and group-by functions. Also lets you compute complex results on the database, instead of reading the objects into the application and computing the results locally. For more information, see "Report Query".
JDBC fetch size and ReadQuery maximum rows | Reduces the number of database hits required to return all the rows that satisfy selection criteria. | For more information, see "JDBC Fetch Size".
Cursors | Lets you view a large result set in manageable increments rather than as a complete collection | For more information, see "Cursored Streams and Scrollable Cursors"
Inheritance views | Allows a view to be used for queries against an inheritance superclass that can read all of its subclasses in a single query, instead of multiple queries | For more information, see "Reading Case 5: Inheritance Views".

See Also

  Query Optimization
  Write Optimization Examples
  Optimization