I am new to teradata.
There are two tables as below:
TABLE 1:
CREATE MULTISET TABLE ACCOUNT_FACT ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
ACC_KEY DECIMAL(18,0) TITLE 'Arrangement Key' NOT NULL,
SOME_DATA VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC
YEAR_MONTH INTEGER TITLE 'Period Key' NOT NULL,
PROCES_DATE DATE FORMAT 'YYYY-MM-DD' TITLE 'Processing Date',
)
PRIMARY INDEX PMY_IDX ( ACC_KEY )
PARTITION BY RANGE_N(YEAR_MONTH BETWEEN 200801 AND 200812 EACH 1 ,
200901 AND 200912 EACH 1 ,
201001 AND 201012 EACH 1 ,
201101 AND 201112 EACH 1 ,
201201 AND 201212 EACH 1 ,
NO RANGE);
TABLE 2:
CREATE SET TABLE TABLE_A ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
ACC_KEY DECIMAL(18,0) TITLE 'Arrangement Key' NOT NULL,
SOURCE_ID CHAR(3) CHARACTER SET LATIN NOT CASESPECIFIC TITLE 'Account Application System Identifier'
)
UNIQUE PRIMARY INDEX PMY_IDX ( ACC_KEY)
;
Note: While loading ACCOUNT_FACT YEAR_MONTH field is extracted from PROCES_DATE field
QUERY:
SELECT A.ACC_KEY, SOME_DATA FROM
ACCOUNT_FACT a
JOIN
TABLE_A B
ON
A.ACC_KEY=B.ACC_KEY
where PROCES_DATE='2011-01-15'
;
It is taking more time to load, is it possible to tune this?
Forums: