|
|
Archives of the TeradataForum
Message Posted: Thu, 09 Sep 2004 @ 15:42:33 GMT
Subj: | | Re: Optimizing SQL |
|
From: | | Fred Pluebell |
Are you sure your UPDATE statement is logically correct? AND has precedence over OR, so I think you want parentheses around the last two OR'ed
conditions. As written, this statement will fail if there is a NULL last_sale_date in the target table and the source table has more than one row.
This will likely make a big difference in the query plan and performance as well.
And is there some reason why (branch_id, customer_no) is not a UNIQUE primary index? Again, you will have problems if more than one qualifying
row with the same (branch_id, customer_no) occurs in the source table.
| |