|
|
Archives of the TeradataForum
Message Posted: Thu, 22 Jan 2004 @ 09:50:08 GMT
Subj: | | Re: Misunderstanding of join index |
|
From: | | Victor Sokovin |
Just wanted to add how the join index might be redefined:
CREATE JOIN INDEX DB.T1_JI AS
SELECT
PA_DAT
, FIELD_1
, FIELD_2,
, SUM(COST) (NAMED AGR_DATE_COST)
FROM DB.T1
GROUP BY 1,2,3
PRIMARY INDEX (FIELD_2);
PI might need a change, perhaps into PRIMARY INDEX (PA_DAT, FIELD_2).
If you actually require lower granularity you might probably rewrite it like this:
CREATE JOIN INDEX DB.T1_JI AS
SELECT
EXTRACT (YEAR FROM PA_DAT)
, FIELD_1
, FIELD_2,
, SUM(COST) (NAMED AGR_YEAR_COST)
FROM DB.T1
GROUP BY 1,2,3
PRIMARY INDEX (FIELD_2);
Hope it works for you and would appreciate your feedback.
Victor
| |