How it works...

Determining the cost of the query is the main job of the optimizer. The costs of columns used in joins come from statistics. The explain plan is not stored for a given query because the data may have changed between executions. 

Row Estimates:

  • May be estimated using random samples, statistics, or indexes
  • Are assigned a confidence level - high, low, or none
  • Affect timing estimates - more rows, more time needed

Timings:

  • Used to determine the ‘lowest cost’ plan
  • Total cost generated if all processing steps have assigned costs
  • Not intended to predict wall-clock time, useful for comparisons

Miscellaneous Notes:

  • Estimates too large to display show three asterisks (***)
  • The accuracy of the time estimate depends upon the accuracy ...

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.