Eradata: Communication in Teradata Teradata DDL's & DML's BTEQ-Intro Session Modes
Eradata: Communication in Teradata Teradata DDL's & DML's BTEQ-Intro Session Modes
Communication in Teradata
Teradata DDLs & DMLs BTEQ-Intro Session Modes
Teradata is an RDBMS that drives companys datawarehouse. Teradata is a collection of objects that provide a logical grouping for information Teradata can be implemented on Unix-based platforms and also on Windows NT. Clients Walmart , kmart, BOA, Whirlpool,Nike AT&T,ICICI Bank,Andhra Bank,Vodafone,British Airways,
FEATURES OF TERADATA
Acts as a server Runs on single(SMP) and multiple nodes(MPP) Built in parallelism Compatible with ANSI standards Designed for DW and DSS Uses massively parallel processing Architecture Uses Shared nothing architecture
Teradata performs the best when data is evenly distributed
HISORY OF TERADATA
1979 Founded in Los Angels USA 1982 YNET technology developed 1991 Acquired by AT&T 1992 Merged into NCR 1996 TDV2 released 2002 TDV2R5 2006 Seperated from NSR 2007 TD12 2009 TD13(viewpoint) Upcoming TD14
Parsing Engine(PE) BYNET AMP(Access Module Processor) Disk Storage Virtual Processors (AMP+PE) Set of software processors that runs under TD PDE(parallel DB extensions)
PE 1.Session Control --Logon Logoff ,managing sessions 2.Acts as Parser 3.Parse and optimize SQL requests 4.Give optimized plan to AMP via Bynet 5. Send query result back to requesting client 6. Does hashing data 7.Capable of handling 120 sessions in parallel and 64 joins in a query
BYNET 1.Loosely couples SMP nodes in a multi node system 2.carries messages between AMP and PEs 3.Communication between nodes ---point to point, broadcast and multicast 4.Merges answers sets back to PE 5.Allows parallelism
AMP
Performs DB and file managenemt operations responsible for Finding the request rows Locks Sorting Joins Output data conversion Accounting/journaling Disk space management Recovery processing Controls portion of a DB Capable of running 80 tasks in parallel
Show displays the DDL of certain objects This includes tables, views, macros, triggers and StoredProcedures
Tables: Two-dimensional structures of columns and rows. Views: Subsets of one or more tables or other views that lack physical rows, pre-defines using a single SELECT statement. Macros: Definitions of one or more Teradata SQL and report formatting commands. Triggers: One or more Teradata SQL statements associated with a table and executed when specified conditions are met. Stored Procedures: Combinations of procedural and non-procedural statements run using a single call statement.
COMUNICATION IN TERADATA
Bynet carries messages between AMPs and PEs Broadcast : Single message delivered to all the nodes. Point to Point : Single message sent to single vproc.
TYPES OF TABLES
Permanent tables Derived tables--query executionSpool space Interm tables-- stored permanently in the DB Volatile table--valid only for the session Global temporary table--structure and data within the session and structure outside the session
TERADATA DDLS
CREATING A TABLE
Data options 1.set 2.Multiset Memory Options 1.Freespace 2.Datablocksize Recovery options 1.Fallback/No Fall back 2.Before Journal/No Before Journal 3.After Journal/No After Journal
Eg: CREATE set table student, no fallback (studentId integer,studentname Varchar(50),DateofBirth date format 'YYYY-MM-DD',Group Varchar(10)) primary Index StudentId Eg: CREATE Multiset table Employee,fallback (EmployeeId Integer NOTNULL Primary Key,Employeename varchar(50),Salary Integer,DOJ date format 'YYYY-MM-DD') unique PrimaryIndex(EmployeeId)-
DROP
Drop is used to permanently delete a table. (No Roll back) The entire structure and data are deleted and the memory is freed. Need to be used with caution.
ALTER
You can Add/ remove a column from an existing table using ALTER TABLE command. The ALTER TABLE statement with MODIFY option cannot be used to change the name of a column or TABLE. Column to be modified should be empty to decrease column length
ALTER TABLE customerdemo ADD CONSTRAINT Pkey1 PRIMARY KEY (accountno); ALTER TABLE customerdemo DROP CONSTRAINT Pkey1
TERADATA DMLS
INSERT
INSERT : Insert new rows into a table. Syntax : INSERT INTO <Table name> VALUES (expression)
We have two methods to insert 1.By value method Eg: Insert into student values(1,'vidya',100) Insert into student values(2,'Adithi',200) 2.Specified columns using value method Eg:Insert into student (no,name) values(3,'Krishna) Insert into student (no,name) values(4,'Vamsi')
UPDATE
UPDATE <TABLE NAME> SET columnname=value [ WHERE condition] Updating All rows
DELETE
DELETE FROM <TABLE NAME> WHERE condition
SELECT
BTEQ
Process Commands, Queries and Data Route Response to Terminal, Files or Printer Usage > Batch Job Scripts > Report Formatting > Ad Hoc Query Tool > Database Administration > SQL Development and Testing Consistent Look and Feel Across Platforms
BTEQ-INTRO
BTEQ is an abbreviation of Basic Teradata Query. It facilitates the communication with the Teradata systems. BTEQ provides the most efficient way to access the Teradata Database. This is command based utility and it has two modes of operations Interactive mode and batch mode. Interactive mode consist of a GUI for interaction with Teradata while batch mode does not. The Interactive mode and Teradata SQL assistant are different thing. BTEQ is Used for reporting & useful in exporting & importing data in (Small volume) (Ex FastExport Script) BTEQ uses CLIv2(Call level interface i.e. CLI) where as SQL assistant uses ODBC driver(Need to configure in your system) BTEQ is a Command Driven Utility and SQL is GUI based BTEQ Supports conditional logic but SQL does not.
SESSION MODES
Bynet handles session control. Logon/Logoff Managing sessions(120) A BTEQ session is created by giving LOGON along with required credentials.
Interactive Mode : User submits commands to the database as and when needed or as and when demand arises. Batch Mode : BTEQ commands and SQL statements are written in a scripted file and then submitted in a batch to BTEQ for processing.