Data caching can be
used to manage the performance of frequently accessed data sources
to minimize impact on the databases and operational servers. You can
free up resources for the high-availability data sources by caching
data that is used often and fairly constant. Overall, data caching
can have a positive effect on user satisfaction and system performance.
When query optimization
alone is not sufficient, caching provides an alternative with greater
flexibility than traditional replication and consolidation techniques.
Any FedSQLdefiner's rights
view can be used to create a cache and caches can be refreshed periodically
to remain synchronized with their parent views. Queries can be processed
against caches just as if you were accessing the original data source.
A definer's rights
view can be cached in any catalog defined in SAS Federation Server,
with the exception of any catalog defined in an MDS service.
When the cache is refreshed, the view is executed and the results
are stored in a table which is named and maintained by SAS Federation Server.
When a user selects from the cached view, results are returned from
the data stored in the table, and not from a dynamic execution of
the view. This improves performance by eliminating the need to derive
a new FedSQL execution plan, fetching
data from slow or unavailable data sources, and performing SQL operations
such as joins or function evaluations. Instead, the view execution
merely fetches the data stored in the table created during the cache
refresh.
Data caching can have
a positive impact on server performance. You can use data caching
to pre-calculate results. Using the following example, a
SELECT from
view V1 would fetch data and calculate the results, returning a single
number. If you cache the result anyone selecting from the view will
receive the result immediately. For example,
CREATE VIEW V1 AS SELECT AVG(B1) FROM A,B,C,D,E
where E .C1 < (SELECT AVG(C1) FROM E) AND B.C1 = A.C1 AND
C.C1 < B.C1 AND D.C1 * E.C1 > SUM(B.C1)
You can also cache tables
or result sets so that they remain consistent during multiple queries.
For example, an ORDERS table is updated continuously during the day
as customers purchase products. Caching the data guarantees consistent
results and reduces the load on the servers, freeing resources to
process incoming orders.