关于OPTIMIZER_MODE值为MULTIPLE CHILDREN PRESENT的问题

asktom有相关简单解释,基本意思是如果你的同一个sql使用了不同的优化器,可能显示的值就是MULTIPLE CHILDREN PRESENT。


You Asked

Hi Tom,

I was looking at the V$SQLAREA table when I saw
"MULTIPLE CHILDREN PRESENT" in the OPTIMIZER_MODE
column.

I spent sometimes through the doc and the net
but have not find any kind of explaination.

Could you give a word on this ? and perhaps
a good place to read through.

Regards
Renauld Chapellier


and we said...

Finding this value in optimizer_mode column of v$sql means that the same query was
executed at least twice with a slightly different executing environment which caused the
optimizer to choose a different execution path.

Some examples:

- Two people selecting from different private tables named emp.

- Same query but are using different session optimizer_mode
  setting.

- Both queries are using cost based, but with a different
  session value for sort_area_size or other CBO related
  parameters.
 
 
 从V$SQLAREA的定义也可以看出,在oracle 9i中,如果存在多个值,就会显示MULTIPLE CHILDREN PRESENT。
This is the definition from Oracle10g 10.2.0.3 :

    SELECT inst_id, kglnaobj, kglfnobj, kglobt03,
          kglobhs0 + kglobhs1 + kglobhs2 + kglobhs3 + kglobhs4 + kglobhs5
          + kglobhs6,
          kglobt08 + kglobt11, kglobt10, kglobt01, kglobccc, kglobclc, kglhdlmd,
          kglhdlkc, kglobt04, kglobt05, kglobt48, kglobt35, kglobpc6, kglhdldc,
          SUBSTR (TO_CHAR (kglnatim, 'YYYY-MM-DD/HH24:MI:SS'), 1, 19), kglhdivc,
          kglobt12, kglobt13, kglobwdw, kglobt14, kglobwap, kglobwcc, kglobwcl,
          kglobwui, kglobt42, kglobt43, kglobt15, kglobt02,
          DECODE (kglobt32,
                  0, 'NONE',
                  1, 'ALL_ROWS',
                  2, 'FIRST_ROWS',
                  3, 'RULE',
                  4, 'CHOOSE',
                  'UNKNOWN'
                  ),
          kglobtn0, kglobcce, kglobcceh, kglobt17, kglobt18, kglobts4, kglhdkmk,
          kglhdpar, kglnahsh, kglobt46, kglobt30, kglobts0, kglobt19, kglobts1,
          kglobt20, kglobt21, kglobts2, kglobt06, kglobt07,
          DECODE (kglobt28, 0, NULL, kglobt28), kglhdadr,
          DECODE (BITAND (kglobt00, 64), 64, 'Y', 'N'),
          DECODE (kglobsta,
                  1, 'VALID',
                  2, 'VALID_AUTH_ERROR',
                  3, 'VALID_COMPILE_ERROR',
                  4, 'VALID_UNAUTH',
                  5, 'INVALID_UNAUTH',
                  6, 'INVALID'
                  ),
          kglobt31, kglobtt0, DECODE (kglobt33, 1, 'Y', 'N'), kglhdclt, kglobts3,
          kglobt44, kglobt45, kglobt47, kglobt49, kglobcla, kglobcbca
      FROM x$kglcursor_child_sqlid
    WHERE kglobt02 != 0


The fllowing is the definition from Oracle9iR2 9.2.0.4:

    SELECT  inst_id, kglnaobj,
            SUM (  kglobhs0
                  + kglobhs1
                  + kglobhs2
                  + kglobhs3
                  + kglobhs4
                  + kglobhs5
                  + kglobhs6
                ),
            SUM (kglobt08 + kglobt11), SUM (kglobt10), SUM (kglobt01),
            COUNT (*) - 1, SUM (DECODE (kglobhs6, 0, 0, 1)),
            DECODE (SUM (DECODE (kglhdlmd, 0, 0, 1)),
                    0, 0,
                    SUM (DECODE (kglhdlmd, 0, 0, 1)) - 1
                    ),
            SUM (kglhdlkc) / 2, SUM (kglobt04), SUM (kglobt05), SUM (kglobpc6),
            SUM (kglhdldc) - 1,
            SUBSTR (TO_CHAR (kglnatim, 'YYYY-MM-DD/HH24:MI:SS'), 1, 19),
            SUM (kglhdivc), SUM (kglobt12), SUM (kglobt13), SUM (kglobt14),
            SUM (kglobt15), SUM (DECODE (kglobt09, 0, kglobt02, 0)),
            DECODE (COUNT (*) - 1,
                    1, DECODE (SUM (DECODE (kglobt09, 0, kglobt32, 0)),
                                0, 'NONE',
                                1, 'ALL_ROWS',
                                2, 'FIRST_ROWS',
                                3, 'RULE',
                                4, 'CHOOSE',
                                'UNKNOWN'
                              ),
                    'MULTIPLE CHILDREN PRESENT'
                    ),
            SUM (DECODE (kglobt09, 0, kglobt17, 0)),
            SUM (DECODE (kglobt09, 0, kglobt18, 0)),
            DECODE (SUM (DECODE (kglhdkmk, 0, 0, 1)),
                    0, 0,
                    SUM (DECODE (kglhdkmk, 0, 0, 1)) - 1
                    ),
            kglhdpar, kglnahsh, kglobts0, kglobt19, kglobts1, kglobt20,
            SUM (kglobt21), SUM (kglobt06), SUM (kglobt07),
            DECODE (kglobt33, 1, 'Y', 'N'), kglhdclt
        FROM x$kglcursor
    GROUP BY inst_id,
            kglnaobj,
            kglhdpar,
            kglnahsh,
            kglnatim,
            kglobts0,
            kglobt19,
            kglobts1,
            kglobt20,
            DECODE (kglobt33, 1, 'Y', 'N'),
            kglhdclt
      HAVING SUM (DECODE (kglobt09, 0, kglobt02, 0)) != 0

你可能感兴趣的:(关于OPTIMIZER_MODE值为MULTIPLE CHILDREN PRESENT的问题)