1.1.1

Table Of Contents
Chapter 32
Evicting Table Data from SQLFire
You can congure tables with least recently used (LRU) eviction and expiration to manage the amount of data that is
kept in a SQLFire system. Use LRU eviction to remove table data from memory, or to persist the overow data in a
disk store.
How LRU Eviction Works
SQLFire keeps a table's data use under a specied level by removing the least recently used (LRU) data to free
memory for new data. You congure table eviction settings based on entry count, the percentage of available
heap, or the absolute memory usage of table data. You also congure the action that SQLFire should take to
evict data: destroy the data or overow data to a disk store (creating a "overow table").
When SQLFire determines that adding or updating a row would take the table over the specied level, it overows
or removes as many older rows as it needed to make room. For entry count eviction, this means a one-to-one
trade of an older row for the newer one.
For the memory settings, the number of older rows that need to be removed to make space depends entirely on
the relative sizes of the older and newer entries. Eviction controllers monitor the table and memory use and,
when the limit is reached, remove older entries to make way for new data. For JVM heap percentage, the controller
used is the SQLFire resource manager, congured in conjunction with the JVM's garbage collector for optimum
performance.
When eviction is enabled, SQLFire manages table rows in a hash map-like structure where the primary key value
is used as the key for all other column data in the row. When a row is evicted, the primary key value remains in
memory while the remaining column data is evicted.
To congure LRU eviction, see Create a Table with Eviction Settings on page 192 and CREATE TABLE on
page 491.After you congure eviction features, you can install a Using a RowLoader to Load Existing Data
and/or synchronous Handling DML Events Synchronously to access an external data source, effectively allowing
SQLFire to be used as a cache. For limitations of this capability, see Limitations of Eviction on page 191.
Limitations of Eviction
LRU eviction is only effective for operations that operate on a primary key value.
Consider these limitations before you implement LRU eviction in your system:
The capability to synchronize with an external data source is only effective for select/update/delete operations
that query data by primary key. Accessing data by other criteria may result in incomplete results, because a
RowLoader is only invoked on primary key queries.
If you congure a table with the DESTROY eviction action, you must ensure that all queries against the table
lter results using a primary key value. Queries that do not lter on a primary key may yield partial results if
rows are destroyed on eviction. This limitation does not apply to tables that are congured with the OVERFLOW
eviction action.
191