SAP ASE caches statements according to certain conditions.
SAP ASE currently caches select, update, delete, and insert select statements with at least one table reference.
The statement text cannot exceed 2MB in size.
If a query includes an abstract plan (provided explicitly or through abstract plan load), and the statement cache is enabled and does not include an entry for the query, SAP ASE caches the plan obtained by the optimizer (and uses the abstract plan in case the abstract plan is legal).
If a query includes an abstract plan (provided explicitly or through an abstract plan load) and the statement cache is enabled and includes an entry for the query, SAP ASE uses the plan corresponding to the query located in the statement cache, bypassing the optimizer and ignoring the abstract plan.
The abstract plan capture feature in on (using set plan dump on)
The statement cache is enabled
A query comes which has an entry in the statement cache
SAP ASE uses the corresponding plan in the statement cache, and bypasses the optimizer and the abstract plan capture feature. That is, SAP ASE performs no abstract plan capture and generates no abstract plan.
SAP ASE does not cache select into statements, cursor statements, dynamic statements, plain insert (not insert select) statements, and statements within stored procedures, views, and triggers. Statements that refer to temporary tables are not cached, nor are statements with language parameters transmitted as binary large object (BLOB) datatypes. Statements that are prohibitively large are not cached. Also, select statements that are part of a conditional if exists or if not exists clause are not cached.