Clone
James Capps <james.capps@hp.com>
committed
on 09 Mar 15
Add new PCode Expression Cache feature.
This new cache is maintained by the SQL Compiler. The purpose of this
cache is to avoid the fairly … Show more
Add new PCode Expression Cache feature.

This new cache is maintained by the SQL Compiler.  The purpose of this

cache is to avoid the fairly expensive logic involved in transforming

unoptimized PCode to optimized PCode and, where applicable, to also

avoid

the logic involved in transforming optimized PCode to a Native

Expression.  This cache is accessed ONLY by the SQL Compiler code.

NOTES:

* This is second attempt to check in this code.  First attempt had to

 be abandoned as other developers made changes which prevented

 automatic merging.

* This code has been pre-reviewed by Justin, Qifan, Selva, Mike,

 Ravisha, Suresh, and Dave B.  Many thanks to them for various

 suggestions.  Most of those suggestions have been incorporated into

 this delivery.  A few are left for future improvements.

* There is one instance of this new cache per CmpContext.

* There are 5 new CQDs used to control this cache.  To be effective for

 all instances of the cache, these need to be set in the system

 defaults table.  The CQD command given to sqlci will affect only the

 instance of the cache for the current CmpContext.

 The 5 CQDs are:

 PCODE_EXPR_CACHE_ENABLED - set to 0 to disable the cache. Default is 1

 PCODE_EXPR_CACHE_SIZE    - max size in bytes. Default is 2,000,000.

 PCODE_EXPR_CACHE_CMP_ONLY - Compare Only mode - useful to QA and

                             Development only.

 PCODE_EXPR_CACHE_DEBUG - set to 1 to enable debug mode. Default is 0

 PCODE_DEBUG_LOGDIR - pathname of existing directory where debug log

                      files will be placed -- one log file per cache

                      instance. Log files are designed to be easily

                      imported into an Excel Spreadsheet. No default.

* Also included are a small number of changes to the Native Expressions

 feature to (a) Use the new PCODE_DEBUG_LOGDIR cqd to specify where to

 put the Native Expressions debug log files, (b) measure cpu-time

 rather than wall-clock time for measuring how long it took to produce

 a Native Expression, and (c) add a CQD named PCODE_NE_ENABLED so we

 can easily disable the Native Expressions feature [though there is

 currently no known reason for doing so.]

Change-Id: I58f833f63099743ff6c1107acdff94fe8aef4b70

Show less

default + 9 more