Troubleshooting Library cache lock (OPTIMIZER EXPRESSION HEADER ) on oracle 19c

The environment is Oracle 19.14 RAC 4-nodes, After the database was upgraded to 19c, there was a performance problem. From AWR, I saw a large number of library cache locks and library cache pins in the top event.namespace was OPTIMIZER EXPRESSION HEADER

TOP EVENT

Event % Event P1, P2, P3 Values % Activity Parameter 1 Parameter 2 Parameter 3
library cache lock 27.55 “13790213352”,”6288331144″,”8978434″ 0.04 handle address lock address 100*mode+namespace
library cache pin 26.13 “19222291528”,”18524475888″,”8978434″ 0.06 handle address pin address 100*mode+namespace

DIAG

Optimizer expression statistics monitoring is introduced in 12.2 database version. Some related tables and views(These objects are defined in doptim.bsq) :
SYS.EXP_HEAD$
SYS.EXP_OBJ$
SYS.EXP_STAT$
DBA_EXPRESSION_STATISTICS


Expression Tracking

Expression statistics monitoring is enabled by default in 12.2. Monitoring expression statistics is introduced for a new optimizer feature in 12.2 to collect expression usage statistics in SQL queries.Expression Tracking feature is enabled only when OPTIMIZER_FEATURES_ENABLE parameter is set to 12.2.0.1.

Note: Currently, it is not possible to turn off Expression Tracking feature using OFE (OPTIMIZER_FEATURES_ENABLE) parameter.However, setting OPTIMIZER_FEATURES_ENABLE=12.1.0.2 or 11.2.0.4 still collects expression tracking information into dba_expression_statistics. Bug 27256484

What is this feature used for? You can imagine that it is useful for optimization in general, but right now it has a single “client”: Oracle Database In-Memory, where it’s referred to as the Expression Statistics Store (ESS).

Monitoring feature is controlled by parameter “_column_tracking_level”.
Disable future monitoring:

if SQL text have huge number of union all  or  too many columns,sql parse time will be increase.  CPU high and SQL parse slow. I’m not sure _column_tracking_level  values means. but you can disable the feature. e.g.

Things to Consider to Avoid Database Performance Problems on 19c (Doc ID 2773012.1)

High CPU for SQL statements with too many columns. The short stack shows functions spinning on qosdGetOptDir, qosdInitDirCtx, qosdUpdExprExecStatsRws. There could be high latch waits including GES latches in RAC.

Solution: Set  _column_tracking_level=1 at system level. Its a dynamic parameter. This is to avoid the extensive column usage tracking which could incur more CPU. The default value was 1 in 11.2 & 12.1 and changed to 21 in 12.2 .

DEBUG

Parameter Name:_kgl_debug Description:Library cache debugging  Type:CHARO bsoleted:FALSECan ALTER SESSION:TRUECan ALTER SYSTEM:IMMEDIATE

KGL=Kernel General Library cache manager

Trace file

 

此条目发表在Oracle, Oracle troubleshooting分类目录,贴了, 标签。将固定链接加入收藏夹。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注