232
Chapter 13
Figure 13-1
Cachingat the Type node to store newly derived fields
ToEnable a Cache
EOn the stream canvas, right-click the node and click Cache on the menu.
EOn the caching submenu, click Enable.
EYoucan turn the cache off by right-clicking th e node and clicking Disable on the caching submenu.
Caching Nodes in a Database
For streams run in a database, data can be cached midstream to a temporary table in the databas e
rather than the le system. When combined with SQL optim ization, this may result in signicant
gains in performance. For example, the output from a stream that merges multip le tables to create
a data mining view may be cached and reused as needed. By automatical lygen erating SQL for
all downstream nodes, performance can be further improved.
When using database caching with strings longer than 255 characters, eith er ensure that there
is a Type node upstream from the caching node and that the eld values are read, or set t he
string length by means of the default_sql_string_length parameter in the options.cfg le. Doing
so ensures that the corresponding column in the temporary table is set to the correct width to
accommodate the strings.
Totake advanta geo fd atabase caching, both SQL optimization and database caching must
be enabled. Note that Server optimiz ation settings override those on the Client. For more
information, see the topic Setting optimization options for streams in Chapter 5 on p. 60.
With database caching enabled, simply right-click any nonterminal node to cache data at
that point, and the cache will be created automatically directly in the database the next time the
stream is run. If database caching or SQL optimizati on is not enabled, the cache will be written
to the le system instead.