Most performance problems in database applications, including those using ORM, are related to the inefficient queries and/or large volumes of data in the database. Here is a few common issues that a typical application may run into:

  • Converting a large ResultSet into objects takes very long time.
  • Storing objects from a large ResultSet takes large amounts of memory. Application may eventually run out of memory and crash.
  • Given a list of objects, there may be a need to retrieve a list of related objects. Often this is done in a suboptimal way, by issuing a single query for each dependent object.

There is no single solution to all performance problems. Cayenne offers a few strategies to improve performance. They should be applied where appropriate.

Sections

  1. Prefetching
  2. Data Rows
  3. Iterating Through Data Rows
  4. Paginated Queries
  5. Caching Lookup Tables
  6. Turning off Context Synchronization