Wednesday, August 15, 2012

named pipe access module in Teradata:


named pipe access module in Teradata:



Note: To invoke Teradata access module check the access module option under perform load in load request

 
Filenames in different operating systems
AXSMOD Name Specifications for Teradata Named Pipes Access Module
Operating System Teradata Parallel Transporter Version Named Pipes Access Module

Linux Shared library file called
np_axsmod.so

UNIX HP-UX PA-RISC Shared library file called
np_axsmod.sl

HP-UX IA64 Not Available
IBM-AIX Shared object file called
np_axsmod.so

Solaris SPARC Shared object file called
np_axsmod.so

Solaris Opteron np_axsmod.so np_axsmod.so

Windows 2000/XP/2003 Dynamic link library file called
np_AXSMOD.dll

Nice link on teradta named pipe access module
http://developer.teradata.com/tools/articles/understanding-named-pipe-access-module-data-transfer




To use Teradata Named Pipes Access Module on UNIX with named pipes:
1) Use the UNIX mknod command with the p option to create a named pipe. In the following
example, /tmp/mypipe is the name of the pipe:
/sbin/mknod /tmp/mypipe p
 

2 Program the writer process to send its output stream to the named pipe, as in the
following FastExport script example:
.EXPORT OUTFILE /tmp/mypipe;
 

3 Program the reader process to read from the named pipe as in the following FastLoad
script example:
axsmod np_axsmod.so “fallback_directory=...”;
define file= /tmp/mypipe;

4 Launch both the writer and the reader processes, as in the following example where
flod.cmds is the name of the FastLoad job script file:
fexp <fexp.cmd & fastload <flod.cmds &
In this example, UNIX connects both processes through the named pipe /tmp/mypipe.

Tuesday, August 7, 2012

Finding/Retrieving CPU cycles in Teradata



The usual causes for a frequently sumbitted SQL to take longer than usual to respond are

(a). The user's session may have been blocked or delayed.
(b). The system may have been busier than usual.
(c). The volume of data the SQL deals with may have increased.

One source I know of retrieving cpu cycles is from DBC.DQLOGTBL. It has log of all the queries run on TD system.

Below are the some of useful columns

collecttimestamp -- timestamp 
SESSIONID  --- useful if there are multiple sessions for a request
USERNAME --
LOGONSOURCE --- logon source will be unique for each request ( one request  could have multiple sessions. So grouping by this will give the cpu for each request by the user at the same time. process number ( i know for unix) would be captured in the logon string)
For more details click this link
http://developer.teradata.com/doc/connectivity/tdnetdp/13.11/webhelp/LogonSourceFormat.html


AMPCPUTIME -- cpu cycles consumed by each query
TotalIOCount
RequestNum   -- query sequence of all teh queries in the request.
StartTime
FirstStepTime
FirstRespTime
QueryText
StatementType
StatementGroup

-->simple query for calc cpu
Select *
from dbc.qrylog
where username = 'xxx'
and cast(starttime as date) = date;


---> I think
delayed time = starttime - firststepTime
execution time = firstStepTime - FirstResponseTime


Let me know if I have made some wrong assumptions above.

Notes on Teradata timestamp


IF the format of the Timestamp literal is …   THEN the data type is …
YYYY-MM-DD hh:mi:ss                               TIMESTAMP(0).
YYYY-MM-DD hh:mi:sssignhh:mi               TIMESTAMP(0) WITH TIME ZONE.
YYYY-MM-DD hh:mi:ss.ssssss                     TIMESTAMP(n), where n is the number of fractional
                                                                         seconds digits.
YYYY-MM-DD hh:mi:ss.sssssssignhh:mi     TIMESTAMP(n) WITH TIME ZONE, where n is the
                                                                         number of fractional seconds digits.




Example 1: YYYY-MM-DD hh:mi:ss Format
The following example selects all classes from the Classes table that are timestamped
November 23 2006 at 3:30:23 PM.
SELECT *
FROM Classes
WHERE Time_stamp = TIMESTAMP '2006-11-23 15:30:23';


Example 2: YYYY-MM-DD hh:mi:sssignhh:mi Format
SELECT *
FROM Classes
WHERE Time_stamp = TIMESTAMP '2002-01-01 10:37:12-08:00'


Example 3: YYYY-MM-DD hh:mi:ss.ssssss Format
SELECT *
FROM Classes
WHERE Time_stamp = TIMESTAMP '1995-07-31 10:36:02.123456'

Example 4: YYYY-MM-DD hh:mi:ss.sssssssignhh:mi Format
SELECT *
FROM Classes
WHERE Time_stamp = TIMESTAMP '1492-10-27 21:17:35.456123+07:30'

Source: Teradata documentation - SQL data types and literal