All Forums Database
johnHenrys 1 post Joined 10/14
20 Feb 2015
Order of execution

I have questions on how does Teradata execute queries?
I use viewpoint and explain for seeing how many queries are executed, however, it doesn't answer all my questions regarding the ordering.
 
1. In the explain output it's not clear when the conditions in the where clause is being applied. Is it before any joins or after?
2. If I wanted the smaller tables to spool first should I always use subqueries & volatile tables to achieve this?
3. Are there commands I can use to explicitly state the best order of execution?
 
Any clarify on this would be very much appreciated

jjj
dnoeth 4628 posts Joined 11/04
20 Feb 2015

Q1: Conditions are applied by the optimizer as soon as possible, usually before the join
Q2: No, the optimizer tries to start with small spools anyway
Q3: No, there's no hint in Teradata, the optimizer is usually smart enough (as long as the neccessary statistics exist)

Dieter

HCDM 21 posts Joined 05/10
20 Feb 2015

jjj,
You posted this question in the "Data Modeling" forum.  I think your target audience for this question in the forumn named "Database".

Lee Arnett
Senior Product Manager – Healthcare Data Modeling
Monument, CO
719-351-0766
Lee.arnett@teradata.com

You must sign in to leave a comment.