4

In Oracle's documentation, for the estimator in optimizer, there is a schema like this: https://docs.oracle.com/database/121/TGSQL/img/GUID-22630970-B584-41C9-B104-200CEA2F4707-default.gif

Normally, as I know, the plan generator generates the plans and handles these plans to the estimator consecutively, to estimate their costs. However, in this schema, after the query transformer, the query is directly passed to the estimator. But there is not any plan yet.

My question is, what happens when the query is first handled to the estimator from the query transformer? Because there is no plan yet. So how it calculates the cost? Or does it directly pass it to the plan generator without any cost in the first time?

Thanks in advance.

oramas
  • 881
  • 7
  • 12
  • 2
    This is one of those things that you don't really need to know the indepth mechanics of. As far as I know, the estimator and plan generator steps are pretty much done at the same time (note the dotted line feeding back into the estimator from the plan generator). In short, don't worry about it. If you really want to see what the optimizer does, run a 10053 trace before running the query for the first time; that will give you output to see the decisions the optimizer has tried and taken, but be warned - it's not easy to understand! – Boneist Dec 19 '18 at 09:45
  • 2
    If you do decide to experiment with ORA-10053 I suggest you read Wolfgang Breitling's classic ["A look under the hood" whitepaper (pdf)](http://www.centrexcc.com/A%20Look%20under%20the%20Hood%20of%20CBO%20-%20the%2010053%20Event.pdf) – APC Dec 19 '18 at 10:51

1 Answers1

1

The estimator is involved in the query optimizer process. Its main task is to measure the plans that give the plan generator.

The end goal of the estimator is to estimate the overall cost of a given plan. If statistics are available,(If you notice in the statistics in the image next to it) then the estimator uses them to compute the measures. The statistics improve the degree of accuracy of the measures.

Baalback
  • 387
  • 7
  • 20