Teradata Quick Notes
Teradata Quick Notes
When a user requires a table for no more than one session, the creation of that table as temporary table can increase performance for the end user, because a temporary table requires no index maintenance. In addition, temporary tables require neither creation nor dropping. With temporary tables, a user can save query results for use in subsequent queries within the same session. Also, a user can break down complex queries into smaller queries by storing results in a temporary table for use during the same session. When the session ends, the system automatically drops the temporary table.
BTEQ
Bteq is available on every Teradata system. It stands for Basic TEradata Query. Features
1. BTEQ can be used to submit SQL in either a batch or interactive environment. 2. BTEQ outputs a report format, where Queryman outputs data in a format more like a
spreadsheet. 3. BTEQ is used for importing and exporting data. Importing Data: Data can be read from a file on either a mainframe or LAN attached computer and used for substitution directly into any Teradata SQL using the INSERT, UPDATE or DELETE statements. Exporting Data: Data can be written to either a mainframe or LAN attached computer using a SELECT from Teradata. You can also pick the format you desire ranging from data files to printed reports to spread sheet formats.
Log In BTEQ commands begin with a period (.) and do not require a semi-colon (;) to end the statement. SQL commands do not ever start with a period and they must always be terminated with a semi-colon.
A bteq can create a table in the script. If the table already exists then it skips the CREATE table step.
BTEQ EXPORT Example Using Record (DATA) Mode .EXPORT DATA FILE = c:\EMPS.TXT
FAST EXPORT
Why it is called "FAST" Export
FastExport is known for its lightning speed when it comes to exporting vast amounts of data from Teradata and transferring the data into flat files on either a mainframe or network-attached computer. A good rule of thumb is that if you have more than half
a million rows of data to export to either a flat file format or with NULL indicators, then FastExport is the best choice to accomplish this task. Keep in mind that FastExport is designed as a one-way utility-that is, the sole purpose of FastExport is to move data out of Teradata. It does this by harnessing the parallelism that Teradata provides.
In addition, FastExport utilizes the Support Environment, which provides a job restart capability from a checkpoint if an error occurs during the process of executing an export job. Fast Export SELECT Statement SPOOL space BUILD Blocks (Work tables) Send to client (ex. Flat file) BTEQ Starts sending rows immediately for storing in file.
SELECT Statement SPOOL space Send to client (ex. Flat file) FAST LOAD Why it is called "FAST" Load
FastLoad is known for its lightning-like speed in loading vast amounts of data from flat files from a host into empty tables in Teradata. Fastload loads the data in empty tables. In order to load data in tables having data we should use Multiload.
Multiload
FastLoad, which can only load one table at a time. And it gets better, yet! This feature rich utility can perform multiple types of DML tasks, including INSERT, UPDATE, DELETE and UPSERT on up to five (5) empty or populated target tables at a time. Two error tables per target.