Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Gordon.

Asked: August 31, 2015 - 2:08 pm UTC

Last updated: September 25, 2015 - 1:04 am UTC

Version: 12.10.2

Viewed 1000+ times

You Asked

Sometimes when I use a QB_NAME hint, when I later look at the execution plan, there is no record of that query block name.

Why is this the case ?

and Tom said...

The optimzier can rewrite your query in some situations. One effect is unnesting subqueries. If this happens, then your subquery is removed and the hint is not present.

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanks

Gordon Cameron, August 31, 2015 - 2:23 pm UTC

OK, that would explain what I'm seeing. For example:

SQL> explain plan for
  2  select /*+ qb_name(q1) */ *
  3  from
  4    ( select /*+ qb_name(q2) */ *
  5      from emp
  6    );

Explained.

SQL> select * from table(dbms_xplan.display(null,null,'BASIC +ALIAS'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Plan hash value: 3956160932

----------------------------------
| Id  | Operation         | Name |
----------------------------------
|   0 | SELECT STATEMENT  |      |
|   1 |  TABLE ACCESS FULL| EMP  |
----------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$D8208F20 / EMP@Q2

Long Absence

Fahd Bahoo, September 01, 2015 - 8:14 am UTC

Hi tom,

Where where you Tom waited for you for 8 months. 
Such a long absence ?

Will you be replying now a day?

Chris Saxon
September 02, 2015 - 1:29 am UTC

AskTom is now back online.

See the asktom community page here: https://community.oracle.com/community/database/asktom

for all the details.

Thanks,
The AskTom team

Last Update Datetime(Home Page)

Shimmy, September 15, 2015 - 12:56 pm UTC

Why is the last update datetime on whole bunch of Q&A have yesterday's date(eg: "Last updated: September 15, 2015 - 2:18 am UTC") and when you click the link/detail, you don't see any new update from yesterday.
Connor McDonald
September 15, 2015 - 6:51 pm UTC

We just added the feature to display who answered the question. This required us to go back through the recent qs and update them to say whether it was Connor or me who answered. Hence the update dates :)

Thanks

Gordon Cameron, September 25, 2015 - 1:03 am UTC

Thanks for the clarification on query block names. Even with transformation, I still think they are quite useful.
Connor McDonald
September 25, 2015 - 1:04 am UTC

I Agree.