Professional Documents
Culture Documents
FastLoad
Vidya T
FastLoad
(Fast Data Load)
• Fast batch mode utility for loading new tables onto the Teradata
database
• Can reload previously emptied tables
• Full Restart capability
• Error Limits and Error Tables, accessible using SQL
• Restartable INMOD routine capability
• Ability to load data in several stages
FastLoad
Teradata
Host
Database
FastLoad Characteristics
Purpose
• Load large amounts of data into an empty table at high speed.
Concepts
• Loads into an empty table with no secondary indexes.
• Has two phases - creates an error table for each phase.
• Status of run is displayed.
• Checkpoints can be taken for restarts.
Restrictions
• Only load 1 empty table with 1 FastLoad job.
• The Teradata Database will accommodate up to 15 FL/ML/FE
applications at one time.
• Tables defined with Referential integrity, secondary indexes, Join
Indexes, or Triggers cannot be loaded with FastLoad.
• Duplicate rows cannot be loaded into multiset table with FastLoad.
• If an AMP goes down, FastLoad cannot be restarted until it is back
online.
FastLoad Phase 1
Host
2 2
1 - FastLoad PE
PE PE
PE
B1R1 B1R1 B2R4
B1R2 B1R2 B2R5
B1R3 B1R3 B2R6
B2R4
B2R5 3 3
B2R6 BYNET
BYNET
BnRx
BnRy AMP11
AMP AMP22
AMP
4 5 4 5
BnRz B1R1 R4 B2R4 R3
B1R2 R2 B2R5 R1
B1R3 R5 B2R6 R6
6 6
R4 R3
R2 R1
R5 R6
Phase 1
• FastLoad uses one SQL session to define AMP steps.
• The PE sends a block to each AMP which stores blocks of unsorted
data records.
• AMPs hash each record and redistribute them to the AMP responsible
for the hash value.
• At the end of Phase 1, each AMP has the rows it should have, but the
rows are not in row hash sequence.
FastLoad Phase 2
2
Host 1 - FastLoad PE
PE
END LOADING;
3 3
BYNET
BYNET
AMP11
AMP AMP22
AMP
5 5
R4 R2 R3 R1
R2 R4 R1 R3
R5 R5 R6 R6
4 6 4 6
R4 R2 R3 R1
R2 R4 R1 R3
R5 R5 R6 R6
Phase 2
• When the FastLoad job receives END LOADING; statement, FastLoad
starts Phase 2.
• Each AMP sorts the target table, puts the rows into blocks, and writes
the blocks to disk.
• Fallback rows are then generated if required.
• Table data is available when Phase 2 completes.
A Sample FastLoad Script
LOGON tdpid/username,password;
DROP TABLE Acct; SETUP
DROP TABLE AcctErr1;
DROP TABLE AcctErr2; Create the table, if
it dosen’t already
CREATE TABLE Acct, FALLBACK ( exist.
AcctNum INTEGER
,Number INTEGER
,Street CHAR(25)
,City CHAR(25)
,State CHAR(2)
,Zip_Code INTEGER)
UNIQUE PRIMARY INDEX (AcctNum);
LOGOFF; FASTLOAD
SESSIONS 8;
Name of empty
LOGON educ2/bank,bkpasswd; table
,:in_Lname
,:in_Fname
,:in_SocSec);
END LOADING;
LOGOFF;
Start Phase 2; if
omitted, utility will
pause
Converting the Data
LOGON educ2/user14,ziplock;
DROP TABLE Accounts;
DROP TABLE Accts_ErrTab_1;
DROP TABLE Accts_ErrTab_2;
CREATE TABLE Accounts, FALLBACK (
Account_Number INTEGER
,Account_Status CHAR(15) FastLoad permits
,Trans_Date DATE conversion from one
,Balance_Forward DECIMAL(5,2)
data type to another,
,Balance_Current DECIMAL(7,2) )
once for each column.
UNIQUE PRIMARY INDEX (Account_Number);
BEGIN LOADING Accounts
ERRORFILES Accts_ErrTab_1, Accts_ErrTab_2;
DEFINE in_Acctno (CHAR(9))
, in_Trnsdate (CHAR(10))
, in_Balcurr (CHAR(7))
, in_Balfwd (INTEGER)
, in_Status (CHAR(10))
FILE = INFILE;
INSERT INTO Accounts Including column names
(Account_Number provides script
documentation which may
,Account_Status
aid in future when
,Trans_Date debugging or modifying the
,Balance_Forward job script.
,Balance_Current)
VALUES (
:in_Acctno
,:in_Status
,:in_Trnsdate (Format ‘YYYY-MM-DD’)
,:in_Balfwd
,:in_Balcurr);
END LOADING;
LOGOFF;
Data Conversion Chart
Allows NULLs to be
preserved
ErrorTable1
Contains one row for each row which failed to be loaded due to
constraint violations or translation errors. The table has three
columns:
ErrorTable2
For non-duplicate rows, captures those rows that cause a UPI
duplicate violation.
Notes
• Duplicate rows are counted and reported but not captured.
• Error tables are automatically dropped if empty upon completion
of the run.
• Performance Note: Rows are written into error tables one row at
a time. Errors slow down FastLoad.
Error Recovery
(A = B + C + D + E)
BEGIN LOADING . . .
CHECKPOINT integer;
END LOADING ;
RECORD 1;
Condition
Condition 1:
1: Abort
Abort inin Phase
Phase 11 -- data
data acquisition
acquisition incomplete.
incomplete.
Solution:
Solution: Resubmit
Resubmit the the script.
script. FastLoad
FastLoad will
will begin
begin from
from record
record 11 or
or the
the first
first
record
record past
past the
the last
last checkpoint.
checkpoint.
Condition
Condition 2:
2: Abort
Abort occurs
occurs inin Phase
Phase 22 -- data
data acquisition
acquisition complete.
complete.
Solution:
Solution: Submit
Submit only
only BEGIN
BEGIN and
and END
END LOADING
LOADING statements;
statements; restarts
restarts
Phase
Phase 22 only.
only.
Condition
Condition 3: 3: Normal
Normal end
end ofof Phase
Phase 11 (paused)
(paused) -- more
more data
data toto acquire,
acquire, thus
thus
there
there isis no
no 'END
'END LOADING'
LOADING' statement
statement inin script.
script.
Solution:
Solution: Resubmit
Resubmit the
the script.
script. FastLoad
FastLoad will
will be
be positioned
positioned toto record
record 11 or
or the
the
first
first record
record past
past the
the last
last checkpoint.
checkpoint.
Condition
Condition 4:
4: Normal
Normal end
end ofof Phase
Phase 11 (paused)
(paused) -- no no more
more data
data toto acquire,
acquire, no
no
'END
'END LOADING'
LOADING' statement
statement was
was inin the
the script.
script.
Solution:
Solution: Submit
Submit BEGIN
BEGIN and
and END
END LOADING
LOADING statements;
statements; restarts
restarts Phase
Phase 22
only.
only.
FastLoad Fails to Complete
LOGON Username, Password;
BEGIN LOADING Accounts
ERRORFILES AcctErr1, AcctErr2;
LOGOFF;
Restarting FastLoad (Output)
LOGON Username, Password;
BEGIN LOADING Accounts
ERRORFILES AccErr1, AccErr2;
DEFINE AcctNum (INTEGER)
:
FDL4803.DEFINE statement processed
INSERT INTO Accounts VALUES (
:
;
FastLoad Restarted
***Number of recs / msg =1442
**** 11:26:45 The last checkpoint was taken at row: 1804231
**** 11:26:45 FastLoad will now restart at row: 1804232
**** 09:41:15 Starting row 1900000
**** 09:41:40 Starting row 2000000
:
**** 09:43:38 Starting row 2800000
**** 09:43:41 Sending row 2820489
**** 09:43:41 Finished sending rows to the RDBMS
END LOADING;
0009 end loading;
FastLoad
Teradata
Host
Database