You are on page 1of 5

Temporary Tables

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.

Global Temporary Tables


Global temporary tables are tables that exist only for the duration of the SQL session in which they are used. The contents of these tables are private to the session, and the system automatically drops the table at the end of that session. However, the system saves the global temporary table definition permanently in the data dictionary.

Volatile Temporary Tables


A volatile temporary table resides in memory but does not survive across a system restart. If a user needs a temporary table for a single use only, they should define a volatile temporary table. Using volatile temporary tables improves performance even more than using global temporary tables, since the system does not store the definitions of volatile temporary tables in the data dictionary. Moreover, users require no privilege to access volatile temporary tables.

Relational Database Terminology


Primary key A unique identifier for a relation. Primary key should not have duplicates. The Teradata RDBMS permits enforcement of the no duplicates rule even when no primary key is specified.

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

BTEQ EXPORT Example Using Field (Report) Mode

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.

How FastLoad Works


What makes FastLoad perform so well when it is loading millions or even billions of rows? It is because FastLoad assembles data into 64K blocks (64,000 bytes) to load it and can use multiple sessions simultaneously, taking further advantage of Teradata's parallel processing. This is different from BTEQ and TPump, which load data at the row level.

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.

You might also like