UNLOAD CACHE GROUP
The UNLOAD CACHE GROUP statement removes data from the cache group.
Required privilege
No privilege is required for the cache group owner.
UNLOAD or UNLOAD ANY CACHE GROUP for another user's cache group.
INSERT, DELETE, UPDATE privileges on underlying tables.
Usage with TimesTen Scaleout
This statement is supported with TimesTen Scaleout.
SQL syntax
UNLOAD CACHE GROUP [Owner.]CacheGroupName [WHERE ConditionalExpression] [COMMIT EVERY n ROWS]
or
UNLOAD CACHE GROUP [Owner.]CacheGroupName WITH ID (ColumnValueList)
Note:
TheWITH ID clause is not supported in TimesTen Scaleout.
Parameters
| Parameter | Description |
|---|---|
|
|
Name assigned to the cache group. |
|
|
Use the |
|
|
Use the
If you specify this clause, the cache agent must be running and the unload must be the only operation in the transaction. Express To improve performance, use this clause when you are performing operations on cache groups that affect large amounts of data. Do not use this clause when you have cache groups with a small amount of data. |
|
|
The The |
Description
-
The
UNLOADCACHEGROUPstatement deletes rows from the TimesTen cache tables without affecting the data in the Oracle database tables. -
If your table has out of line columns and there are millions of rows, consider calling the
ttCompactbuilt-in procedure to free memory. -
If the cache group is replicated, an
UNLOAD CACHE GROUPstatement deletes the entire contents of any replicated cache group as well. -
Execution of the
UNLOAD CACHE GROUPstatement for an AWT cache group waits until updates on the rows have been propagated to the Oracle database. -
The
UNLOAD CACHE GROUPstatement can be used for any type of cache group. See "CREATE CACHE GROUP" for information on cache groups. -
Use the
UNLOAD CACHE GROUPstatement carefully with cache groups that have theAUTOREFRESHattribute. A row that is unloaded can reappear in the cache group as the result of an autorefresh operation if the row or its child rows are updated in the Oracle database. -
Following the execution of an
UNLOAD CACHE GROUPstatement, the ODBC functionSQLRowCount(), the JDBC methodgetUpdateCount(), and the OCI functionOCIAttrGet()with theOCI_ATTR_ROW_COUNTargument return the number of cache instances that were unloaded. -
If you specify the
COMMITEVERYnROWSclause, the cache agent performs the unload operation and commits the transaction after unloading the data. Make sure the cache agent is up and running. If you do not specify theCOMMITEVERYnROWSclause, the unload operation is executed by the application. -
If you specify the
COMMITEVERYnROWSclause, you cannot rollback the unload operation. If the unload operation fails when you specify theCOMMITEVERYnROWSclause (wheren>= 0), the cache group could be in an inconsistent state since some unloaded rows are already committed. Therefore, some cache instances may be partially unloaded. If this occurs, unload the cache group again. -
Use the
WITH IDclause to specify binding parameters. -
The
UNLOADCACHEGROUPoperation is executed in its own transaction.
Restrictions
-
The
UNLOADCACHEGROUP...WITHIDclause is not supported in TimesTen Scaleout. -
Do not reference child tables in the
WHEREclause. -
Do not user the
WITHIDclause on static read-only cache groups, or static user-managed cache groups with the autorefresh attribute. -
Do not use the
WITH IDclause with theCOMMIT EVERYnROWSclause.
Examples
Use the UNLOAD CACHE GROUP... COMMIT EVERY n ROWS to unload data from cached tables. The cache agent unloads the data because the COMMIT EVERY n ROWS clause is used.
Command> UNLOAD CACHE GROUP testcache WHERE sampleuser.orders.order_id > 100 COMMIT EVERY 100 ROWS; 2 cache instances affected.
CREATE and UNLOAD a cache group. The application performs the unload operation because the COMMIT EVERY n ROWS clause is not used.
CREATE CACHE GROUP recreation.cache FROM recreation.clubs ( clubname CHAR(15) NOT NULL, clubphone SMALLINT, activity CHAR(18), PRIMARY KEY(clubname)) WHERE (recreation.clubs.activity IS NOT NULL); UNLOAD CACHE GROUP recreation.cache;