Caching
Caching and Performance
When a query is executed against a database, many pieces of information are exchanged between the client and the server. Query statements, result sets, and schema information are moved between the client and the server during the lifetime of most applications. The performance of many programs can be improved by using techniques that decrease this intensive data flow. One of the most common of these techniques is caching.
The DB Interface Module addresses this issue in two main ways:
*Efficient data insertion and reading. Rather than writing similar data to the database in a series of small transactions, the DB Interface Module allows you to cache the data and write it to the database in a single transaction. Similarly, a set of similar data can be read in a single transaction, cached, and supplied to the application as needed. See Caching When Inserting and Reading Data.
*Efficient handling of metadata. In addition to the actual data being stored, database queries often involve the exchange of metadata, which slows the overall operation. Examples of such metadata include table schemas, table constraints and stored procedure parameters. The DB Interface Module supplies a cache manager, RWDBCacheManager, for storing such information so it can be referenced locally rather than requiring a database transaction. See Metadata Caching and the Cache Manager.
If you plan your program’s database interactions carefully, you stand a good chance of significantly improving its performance. Of course, there are many factors involved, so the only true test of whether your program is benefiting from caching is performance testing.