Вы находитесь на странице: 1из 25

Agenda Part 1

What is the EXPLAIN facility?


Where does the EXPLAIN output come from?
What does the Optimizer need to build a plan?
What can be learned by reading the EXPLAIN text?
What can be done to influence the OPTIMIZER?

1/4/12

Footer

Teradata Confidential and Proprietary

What is the Explain Facility?


The Explain Facility provides English like translation of the plan SQL
Optimizer develops to service a request
Explain may be used on any SQL statement, except explain Itself
While using explain look for Keywords and Phrases.
Execution Cost and Row count estimates depends on Statistics.
Actual execution time depends on:
database processing other requests
network (or channel) usage

1/4/12

Footer

Teradata Confidential and Proprietary

Information Needed by Optimizer


TD Environment information:
number of nodes
number of AMPS
number and type of CPUs
Disk Array Information
BYNET information
Amount of memory available
Data Demographics:
number of rows in a table
row size
column demographics
range of values in a table for the column
number of rows per value
number of NULLs for the column
Index Demographics

1/4/12

Footer

Teradata Confidential and Proprietary

EXPLAIN PLAN Keywords


Explain Keywords

Explanation

with no residual conditions

All applicable conditions have been applied to the rows.

eliminating duplicate rows ..

(Duplicate rows only exist in spool files, not set tables.) Doing a DISTINCT
operation.

by way of a traversal of index #n extracting row ids only

A spool file is built containing the Row IDs found in a secondary index (index #n).

we do a SMS (set manipulation step)

Combining rows using a UNION, MINUS, or INTERSECT operator.

we do a BMSMS (bit map set manipulation step)

Doing a NUSI Bit Map operation.

which is redistributed by hash code to all AMPs. / which is


duplicated on all AMPs.

Relocating data in preparation for a join.

(one_AMP) or (group_AMPs)

Indicates one AMP or a subset of AMPs will be used instead of all AMPs.

("NOT (table_name.column_name IS NULL)")

feature in which optimizer realizes that column being joined to is NOT NULL or has
referential integrity.

Joined using a row id join

Indicates a join back condition with a join index.

with high confidence . . .

Restricting conditions exist on index(es) or column(s) that have collected statistics.

with low confidence . . .

Restricting conditions exist on index(es) or column(s) that have collected statistics


but are AND-ed / OR-ed together with conditions on non-indexed columns.

with no confidence . . .

Conditions outside the above.

4 index join
1/4/12
with
confidence . . .

Footer
A join condition via a index.

Teradata Confidential and Proprietary

1/4/12

Footer

1/4/12

Footer

1/4/12

Footer

1/4/12

Footer

1/4/12

Footer

10

1/4/12

Footer

11

1/4/12

Footer

12

1/4/12

Footer

13

1/4/12

Footer

14

1/4/12

Footer

15

1/4/12

Footer

16

1/4/12

Footer

17

1/4/12

Footer

18

1/4/12

Footer

19

1/4/12

Footer

20

1/4/12

Footer

21

1/4/12

Footer

22

1/4/12

Footer

23

1/4/12

Footer

24

1/4/12

Footer

25

1/4/12

Footer

Вам также может понравиться