RE: Crazy dynamic sampling?

From: Dominic Brooks <>
Date: Tue, 17 Apr 2018 09:49:57 +0000
Message-ID: <DB6P190MB05011DC78721B48EBB8D43D2A1B70_at_DB6P190MB0501.EURP190.PROD.OUTLOOK.COM>

Yes Ė itís not a parallel query.

When there are other sessions blocked Ė they are just different executions of the same query waiting for this first one to quit with the crazy hard parsing.

From: Mark W. Farnham <>
Sent: Tuesday, April 17, 2018 10:45:56 AM To:; 'Stefan Knecht'; 'oracle-l-freelists' Subject: RE: Crazy dynamic sampling?

After it finally finishes parsing, did the plan end up serial?

There is a specific bug where the children donít get the same plan as the coordinator, and they try again and again until some limit or timeout is reached and then you get the one original plan running serially. (I was puzzled why the hash wasnít just passed instead of re-parsing, but thatís another issue unexplored.)

Unfortunately all my notes on this were behind a secure area (canít take pictures or forward the email, even if you could hack it you agreed not to try) and the customer throws all that away every 90 days and flatlines your PC hard drive to re-use and discards your host linux server files at the end of the project so I canít look back and type you a specific number or combination of numbers.

Pantloads of cursor: pin S wait on X event were a feature of this bug. That was however 12.1.x. Iím not sure whether the patch to fix this or turning off adaptive plans or both were required to make the bad behavior go away. I donít know if this can happen on 11.x.

Grahamís colleague Mihajlo Tekic probably has accurate notes on this because he helped solve it and had seen it before and Oracle was magically allowed to transport their notes wherever they liked. Twas brillig.

Possibly this behavior is already well-known, I just hadnít seen it before.


From: [] On Behalf Of Dominic Brooks Sent: Tuesday, April 17, 2018 5:14 AM
To: Stefan Knecht; oracle-l-freelists
Subject: RE: Crazy dynamic sampling?

Itís not the subsequent mutexes that Iím bothered about. More about why the session at the head of the queue is hard parsing for minutes or hours.

From: Stefan Knecht <<>> Sent: Tuesday, April 17, 2018 10:09:35 AM To: Dominic Brooks; oracle-l-freelists
Subject: Re: Crazy dynamic sampling?

Not seen that on

What mutex and location exactly are the sessions waiting on? You can hit x$mutex_sleep from the p2 in v$session for the cursor: pin S wait on X event. Some more details on how to do thatare here: WAITEVENT: "cursor: pin S wait on X" Reference Note (Doc ID 1298015.1)

Then I'd search MoS for bugs related to that mutex location.

On Tue, Apr 17, 2018 at 3:55 PM, Dominic Brooks <<>> wrote: Good question Ė sorry for missing that out.

From: Stefan Knecht <<>> Sent: Tuesday, April 17, 2018 9:54:57 AM To: Dominic Brooks; oracle-l-freelists
Subject: Re: Crazy dynamic sampling?

Are you on ?

On Tue, Apr 17, 2018 at 3:49 PM, Dominic Brooks <<>> wrote:

In addition to invisible indexes not being so invisible, I hash partitioned some global PK indexes to reduce insert hot block contention.

These two things Ė invisible local indexes with some unusable subpartitions and hash partitioned PK indexes - are the only things which changed.

Iíve now got a few handfuls of statements which, in addition to some of them doing table expansion thanks to the not-so-invisible invisible indexes, are doing crazy long hard parsing Ė like 30 to 40 minutes. And that causes knock-on effects to other sessions in the same workflow for the same sql / objects with ďcursor: pin S wait on XĒ and ďlibrary cache lockĒ

The likely culprit is dynamic sampling. I can see the sessions doing lots of IO against different table partitions as part of the hard parse.

Otherwise the health of the database is no less healthy than it was before and the SQL is the same SQL as it was before.

Whilst I wait for an optimizer trace file and some other dumps/traces, any wild theories as to why just hash partitioning a global PK might cause this?

From: Dominic Brooks <<>> Sent: Tuesday, April 10, 2018 11:09:03 AM To:<> Subject: Re: Invisible indexes and table expansion

Probably just covered by bug 16544878.

Sent from my iPhone

> On 10 Apr 2018, at 10:50, Dominic Brooks <<>> wrote:
> Just working through a problem, gathering evidence and trying to reproduce. And itís difficult for me to get an optimiser trace file in the environment.
> In an environment, Iíve got a whole bunch of queries now using table expansion - VW_TE_2.
> Recent change was to add three local indexes, each with a subset of partitions as usable - something which table expansion was designed to help with.
> But they are invisible indexes.
> So my theory is the invisibility is limited - ie they are visible enough to cause table expansion - but then canít be used.
> Anyone looked into something similar?
> Cheers
> Dominic
> Sent from my iPhone

zztat - The Next-Gen Oracle Performance Monitoring and Reaction Framework!
Visit us at<> | _at_zztat_oracle |<> |<>

zztat - The Next-Gen Oracle Performance Monitoring and Reaction Framework!
Visit us at<> | _at_zztat_oracle |<> |<>

Received on Tue Apr 17 2018 - 11:49:57 CEST

Original text of this message