Saturday 29 August 2015

Complete introduction to referential integrity in Teradata - Example script and explanation

DATABASE RETAIL; 

DROP TABLE ORDERS;

/* Creation of the Parent Table  ORDERS */

CREATE MULTISET TABLE ORDERS
(
ORDER_ID INTEGER NOT NULL PRIMARY KEY
, ORDER_NAME VARCHAR(30) CHECK(CHAR_LENGTH(ORDER_NAME) > 1)
, ORDER_DT DATE FORMAT 'YYYY-MM-DD'
---, PRIMARY KEY(ORDER_ID)
)
PRIMARY INDEX(ORDER_NAME)
;

/* TESTING FOR THE CHECK CONSTRAINT */

INSERT INTO ORDERS (1,'PENCIL','2015-08-10');
INSERT INTO ORDERS (2,'PEN','2015-08-10');

/* CREATE A CHILD TABLE WITH REFERENTIAL INTEGRITY ON ORDERS TABLE */

DROP TABLE TRANSACT;
CREATE MULTISET TABLE TRANSACT
(
TRANSACT_ID INTEGER
, ORDER_ID INTEGER REFERENCES RETAIL.ORDERS
, TRANSACT_DATE DATE FORMAT 'YYYY-MM-DD'
, POS_NUMBER DECIMAL(18,0) NOT NULL UNIQUE
)
PRIMARY INDEX(TRANSACT_ID);

/* TRY INSERT VALUES WHICH ARE NOT PRESENT IN THE ORDERS TABLE */

INSERT INTO TRANSACT(1, 3, '2015-09-10', 1);

--- SINCE 3 IS NOT PRESENT IN THE ORDERS PARENT TABLE, THIS IS GIVING FOREIGN KEY ERROR


INSERT INTO TRANSACT(1, 1, '2015-09-10', 1);
INSERT INTO TRANSACT(1, 1, '2015-09-10', 2);
INSERT INTO TRANSACT(3, 1, '2015-09-10', 1);

Once the Child table is created, we will not be able to ALTER the DDL of the PARENT table. 

As seen below , we will get an error if we run the Drop table statement.

/* THE BELOW QUERY WILL GIVE YOU AN ERROR AS ITS REFERNCED BY A CHILD TABLE */
DROP TABLE RETAIL.ORDERS;

ALTER table in Teradata will fail once we have created CHILD tables

Since, we want to find out the child tables for the ORDERS table, we can query the ALL_RI_Parents metadata tables. To edit a Parent table, we will have to drop the child tables also.

/* MODIFY THE STRUCTURE OF A PARENT TABLE
 * THEN THE BELOW QUERY CAN BE USED */
SELECT * FROM DBC.All_RI_Parents;


parent and child tables in teradata ALL_RI_PARENTS metadata table

Example Script to find the Nodes, AMP and PE's in a system in Teradata - Diagram and Representation

----- How to find the total nos. of AMP and PE per node


SELECT DISTINCT NODEID,VPROC1 AS "NO_OF_AMPS" , VPROC2 AS "NO_OF_PE"FROM DBC.ResGeneralInfoView;


---- The result will be as follows:
For NODE 101, we have 2 AMPs and 1 PE. Many Developers make the mistake that each vproc is 1 AMP and 1 PE.

Each PE can spun upto 120 sessions. Though, this configuration is tunable, but its best left unchanged.

We should just add enough PE's to handle session load.

Most people feel that the PE will be equal to the no. of AMP's in the system.


That is not the case as illustrated in the diagram below.

Node Configuration in Teradata

vproc comprises of AMP and PE. PE can also talk to other nodes. Hence for representational purpose, we show the PE above the AMP's as show below:

PE and AMP diagram

Join us in a discussion on Teradata in our classroom. Register using the link and we will contact you.



Wednesday 12 August 2015

DML / DDL operations and their Locking mechanism in Teradata - How to avoid dead locks in Teradata

DML/DDL operations and the Locks acquired

Deadlocks and Deadlock Resolution
A deadlock occurs when transaction 1 places a lock on resource A, and then needs to lock resource B. But resource B has already been locked by transaction 2, which in turn needs to place a lock on resource A. This state of affairs is called a deadlock.

Both the Transaction need the resource of the other for completion
 To resolve a deadlock, Teradata Database aborts the younger transaction, the one that has held the resource the least amount of time, and performs a rollback.
In the diagram below, the Transaction T2 will have to release its lock as its the younger transaction.
Deadlocks in Teradata and their resolution

If you used BTEQ to submit the transaction, the database reports the deadlock abort to BTEQ. BTEQ resubmits only the request that caused the error (the default behavior), not the complete transaction. Because this can result in partially committed transactions, you must take care when writing a BTEQ script to ensure that the transaction is one request. For example, a statement in BTEQ ends with a semicolon (;) as the last non‑blank character in the line. Thus, BTEQ sees the following example as two requests:
    sel * from x;
    sel * from y;
However, if you write these same statements in the following way, BTEQ sees them as only one request:
   sel * from x
   ; sel * from y;

If you want to know more about our online/classroom classes, kindly send us your details and we will call you back.

Sunday 9 August 2015

Best Teradata Training in Bangalore


 
Best  Teradata  training institute ecare technologies bangalore,  provides real-time and placement oriented Teradata     training in Bangalore. ecaretechnologies provides Best Teradata     training courses in bangalore . ecare  Teradata  training  course content designed basic to advanced levels. we have a team of Teradata   experts who are working professionals with hands on real time Teradata  projects knowledge, which will give students an edge over other Training Institutes. Teradata     training  course content  is designed to get the placement in major MNC companies in bangalore as soon as you complete the Teradata   training course.

Best Teradata    training institute in Bangalore focus on the needs of the Teradata  community. Ecare technologies listed one of the top Teradata  training institutes in Bangalore. We offer Teradata     education for working professionals. Teradata     training in Bangalore understands the need of Teradata   community. we offer all Teradata  training courses as students option. Ecare technologies provides free Teradata   training materials of soft copy and hard copy. Discover best Teradata  training in Bangalore at Ecare technologies
Our Teradata   training courses helps to students to get placement immediately after course completion. Our practical ,real time Teradata  project scenarios training helps to work on Teradata  projects. Our Teradata   training program helps every student to achieve their goal in Teradata   career.

Best Training Institute,ecare technologies,Marathalli  Bangalore offers  training with choice of multiple training locations across bangalore. Ecare technologies Teradata  training  centers are having Best lab facilities and excellent infrastructure. we have successfully trained and provided placement for many of our Trained Teradata  students, Teradata   training  training course fee is very economical compared to other Training Institutes In Bangalore

Teradata   Training In Bangalore ,ecaretechnologies provide regular training classes,Morning Batches,Evening Batches, weekend training classes, and fast track training classes for Teradata . Ecaretechnologies provides online and Corporate training classes for Teradata    



Teradata training course content and Syllabus in Bangalore
TERADATA COURSE CONTENT

  • What is Teradata?
  • Teradatav12 &versions
  • Teradata History
  • Teradata users scalability
  • Teradata &other RDBMS
  • Teradata warehouse
  • Teradata in the Enterprise
  • Interview Q&A and Certification queries
  • Real time Issues & resolving

Teradata architecture & it’s components:

  • Node Architecture(Shared Architecture)
  • SMP Architecture
  • MPP Architecture
  • Parsing engine(PE) Architecture
  • AMP Architecture &uses
  • Bynet Benefits &types
  • Parallel data extension(PDE)
  • Teradata directory program(TDP)
  • Call level interface(CLI)
  • Trusted parallel application(TPA)
  • Virtual processors
  • Bynet 0 &Bynet 1
  • Parallism Architecture

Recovery &protection of Data:

  • What is fall back &where it used
  • Why for fall back
  • What is Clique
  • AMP Clustering
  • Locks & types for simultaneous Access
  • Why for locks &how to release
  • RAID 1 &RAID 5
  • Journals &types
  • Virtual Disk Array
  • How & where is used journals
  • Q & A about data recovery

Teradata indexes:

  • Types of indexes in Teradata
  • Hash index
  • Join index
  • Primary index(unique, non- unique)
  • Secondary index(unique, non- unique)
  • Skewness
  • Keys & indexes (How & why these used)

How to storage & retrieval of data :

  • Hash algorithm
  • Row hash
  • Hash map
  • Hash bucket
  • Receiving VDisc

Teradata SQL Quarryman:

  • SQL fundamentals
  • Data types and literals
  • DDL Statements
  • DML Statements Teradata naming conversing

Teradata SQL Functions & operations:

  • String functions
  • Format functions
  • Cast functions
  • Cast functions
  • Group & Aggregation functions
  • Logical operations
  • Arithmetic operations
  • set operations
  • join operations
  • conditional expressions

Teradata join strategies & unions:

  • hash join
  • merge join
  • nested join
  • product join
  • inner join
  • left & right outer join
  • full outer join

Teradata basic commands:

  • Help
  • Show
  • Explain
  • Collect statistics

Teradata objects:

  • Types of tables
  • Set tables
  • Multi tables
  • Volatile tables
  • Global temporary tables
  • Derived tables
  • Views
  • Macros
  • Stored procedures
  • Triggers

Teradata memory spaces:

  • Permanent spaces
  • Temporary spaces
  • Spool spaces
  • Users spaces & PWD

Teradata transaction modes:

  • Batch mode
  • BTET mode
  • ANSI mode
  • How Converted into others

Teradata performance tuning on SQL Assistance:

  • Usage of PMON
  • Explain usage
  • Collecting statistics
  • SQL tuning
  • Various SQL statements
  • Real time Issues & resolving

Teradata Utilities & Tools (Import & Export):

  • Teradata BTeq scripts
  • Overview of BTeq
  • Looping stages
  • Batches scripts
  • Import &export scripts with Examples
  • Error handling
  • Real time scripts

Teradata FastLoad:

  • Types of phages & how to find it
  • Advantages & its process
  • Limitations of fast load
  • Real time scripts

Teradata MultiLoad:

  • Overview of Multi load
  • Types of phages in MultiLoad
  • Advantages & its process
  • Limitations of MultiLoad
  • Uses various types of operations
  • Work on Multi tables
  • Real time scripts
  • Sample scripts

Teradata Tpump:

  • Overview of Tpump
  • Limitations of Tpump
  • Work on Multi tables
  • Real time scripts
  • Sample scripts

Teradata Fast Export:

  • How to export the data
  • Passing parameters
  • IN/OUT Modes
  • Work on Multi tables
  • Real time scripts
  • Sample scripts
  • Teradata SQL Assistant(Quarryman)
  • Teradata performance monitor
  • Teradata Administrator usage
  • Teradata performance tuning on scripts