2)FASTLOAD分为两个阶段:
第1阶段 - 从数据文本中读取记录,只需放到目标AMP上即可
第2阶段 - 在AMP内部按Rowhash进行排序
3)FASTLOAD的目标表初始的时候只能是个空表。
4)FASTLOAD的目标表不能定义次索引,但可以定义分区字段。
5)FASTLOAD一次只能对一张表进行加载,不支持对多张表进行加载。
6)FASTLOAD支持多个数据文件一次性加入一张表中,但这些数据文件是串行加载并非并行加载。
7)FASTLOAD在加载的时候会自动剔除文本中的重复记录,即使目标表定义为multiset table。
典型的fastload脚本示例如下:
/* 限制错误记录条数*/ ERRLIMIT 1; /* 数据库登录语句*/ LOGON ETL_TD_STAGE,ETL_TD_STAGE; /* 建表模块*/ DATABASE TD_STAGE; DROP TABLE AUCTION_PROPERTY; DROP TABLE PLOG.AUCTION_PROPERTY_E1; DROP TABLE PLOG.AUCTION_PROPERTY_E2; CREATE MULTISET TABLE AUCTION_PROPERTY ,NO FALLBACK , NO BEFORE JOURNAL, NO AFTER JOURNAL, CHECKSUM = DEFAULT ( AUCTION_ID CHAR(32) CHARACTER SET LATIN CASESPECIFIC, PROPERTY_ID DECIMAL(11,0), PROP_VID INTEGER, STATUS INTEGER, GMT_CREATE TIMESTAMP(0), GMT_MODIFIED TIMESTAMP(0), INS_DATE TIMESTAMP(0)) PRIMARY INDEX ( AUCTION_ID ); /* 方式一:设置加载方式为变长,分割符为Tab键*/ /* 同时,进入加载第1阶段*/ .SET RECORD VARTEXT " " NOSTOP BEGIN LOADING AUCTION_PROPERTY ERRORFILES PLOG.AUCTION_PROPERTY_E1,PLOG.AUCTION_PROPERTY_E2; /* DEFINE模块,定义数据文本格式和存放路径*/ DEFINE AUCTION_ID (VARCHAR(42),nullif='') ,PROPERTY_ID (VARCHAR(21),nullif='') ,PROP_VID (VARCHAR(20),nullif='') ,STATUS (VARCHAR(20),nullif='') ,GMT_CREATE (VARCHAR(25),nullif='') ,GMT_MODIFIED (VARCHAR(25),nullif='') ,INS_DATE (VARCHAR(25),nullif='') FILE=/bak/Teradata/auction_property.txt; /* 方式二:设置加载方式为定长,分割符为Tab键*/ DEFINE AUCTION_ID (VARCHAR(42),nullif='') ,TAB1 (CHAR(1)) ,PROPERTY_ID (VARCHAR(21),nullif='') ,TAB2 (CHAR(1)) ,PROP_VID (VARCHAR(20),nullif='') ,TAB3 (CHAR(1)) ,STATUS (VARCHAR(20),nullif='') ,TAB4 (CHAR(1)) ,GMT_CREATE (VARCHAR(25),nullif='') ,TAB5 (CHAR(1)) ,GMT_MODIFIED (VARCHAR(25),nullif='') ,TAB6 (CHAR(1)) ,INS_DATE (VARCHAR(25),nullif='') ,NEWLINE (CHAR(1)) FILE=/bak/Teradata/auction_property.txt; /* 设置加载起点,也可以设置加载终点(THRU)*/ RECORD 1; /* INSERT模块,定义物理表对应的格式*/ INSERT INTO TD_STAGE.AUCTION_PROPERTY( AUCTION_ID ,PROPERTY_ID ,PROP_VID ,STATUS ,GMT_CREATE ,GMT_MODIFIED ,INS_DATE ) VALUES ( :AUCTION_ID ,:PROPERTY_ID ,:PROP_VID ,:STATUS ,:GMT_CREATE (format 'yyyymmddhhmiss') ,:GMT_MODIFIED (format 'yyyymmddhhmiss') ,:INS_DATE (format 'yyyymmddhhmiss') ); /* 第1阶段结束,进入加载第2阶段*/ END LOADING; /* 数据库退出语句*/ LOGOFF; 典型的fastload日志示例如下: /* 第1阶段,文本记录无序录入到AMP上*/ **** 19:44:59 Number of recs/msg: 3 **** 19:44:59 Starting to send to RDBMS with record 1 **** 19:45:08 Starting row 100000 **** 19:45:18 Starting row 200000 **** 19:45:28 Starting row 300000 **** 19:45:38 Starting row 400000 **** 19:45:48 Starting row 500000 **** 19:45:58 Starting row 600000 **** 19:46:08 Starting row 700000 **** 19:46:18 Starting row 800000 **** 19:46:28 Starting row 900000 **** 19:46:38 Starting row 1000000 **** 19:46:39 Sending row 1015760 **** 19:46:39 Finished sending rows to the RDBMS /* 第2阶段,AMP内部进行排序*/ =================================================================== = = = End Loading Phase = = = =================================================================== 0013 END LOADING; **** 19:47:58 END LOADING COMPLETE Total Records Read = 1015760 - skipped by RECORD command = 0 - sent to the RDBMS = 1015760 Total Error Table 1 = 0 ---- Table has been dropped Total Error Table 2 = 0 ---- Table has been dropped Total Inserts Applied = 1015760 Total Duplicate Rows = 0 Start: Thu Mar 01 19:46:40 2007 End : Thu Mar 01 19:47:58 2007 2.Using fastload batch mode运行参数: 3.两个错误日志表区别: errortname1 • Constraint violations • Conversion errors • Unavailable AMP conditions These types of errors always occur during the loading phase of your FastLoad job—after executing the BEGIN LOADING command, but before the END LOADING command. errortname2 Unique primary index violations This type of error always occurs during the end-loading phase of your FastLoad job—after executing the END LOADING command.