Archives of the TeradataForum
Message Posted: Fri, 11 Jun 2004 @ 13:21:43 GMT
Subj: | | Re: Performance Improvement on this Query without Collecting Statistics |
|
From: | | Geoffrey Rommel |
| FROM DAILY_SPEND s
JOIN DATE dt on dt.DateID = s.DateID | |
You didn't mention which version of Teradata you're running. V2R4.1 and earlier versions may produce a better query plan with the comma syntax
(from daily_spend s, "date" dt where ...).
| On the DATE side, you can aggregate on the BCWEEKID such that you only have one row per BCWEEKID with a min date representing the
beginning of the week and a max date representing the end of the week. You could then change the equality compare in the where clause to a
BETWEEN. | |
A fine suggestion. If you take this approach, you might also try a value-ordered index on the dates -- something like this:
create index (min_date, max_date) order by values(min_date) on weekly_spend;
collect stats on weekly_spend index(min_date, max_date);
Come to think of it, a value-ordered date index might help no matter what.
|