How efficient is this approach? With a predefined query, the analysis and optimization of a request are all carried out when a class is compiled, not when the query is run. With a dynamic query, on the other hand, you might think we need to carry out request analysis and optimization every time for every request. Fortunately, with Caché this is not
For each dynamic query it processes, Caché remembers the query's source (e.g. the SQL SELECT request) as well as the optimized and compiled form of the query. Whenever a query is received, the system automatically checks whether a matching precompiled query is available. If so, it is run automatically, avoiding the normal query processing overhead.
In case you are worried about the database being overrun with saved queries that are never used again, you can purge the queries using the System Management Portal. Click
, and then click the
link and then click
. Use the
link at the top of the page to change namespaces, if necessary.
© 1997-2019 InterSystems Corporation, Cambridge, MA