<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TeraData Tech</title>
	<atom:link href="http://www.teradatatech.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.teradatatech.com</link>
	<description>Learn Teradata the easy way ...</description>
	<lastBuildDate>Fri, 18 May 2012 11:25:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Secondary Index in Teradata</title>
		<link>http://www.teradatatech.com/?p=815</link>
		<comments>http://www.teradatatech.com/?p=815#comments</comments>
		<pubDate>Wed, 16 May 2012 16:32:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Basics]]></category>
		<category><![CDATA[2 amp operation]]></category>
		<category><![CDATA[all amp operation]]></category>
		<category><![CDATA[collect stats on SI]]></category>
		<category><![CDATA[creation of secondary index]]></category>
		<category><![CDATA[non unique secondary index]]></category>
		<category><![CDATA[NUSI]]></category>
		<category><![CDATA[Secondary index in teradata]]></category>
		<category><![CDATA[SI]]></category>
		<category><![CDATA[SI in teradata]]></category>
		<category><![CDATA[unique secondary index]]></category>
		<category><![CDATA[use of secondary index]]></category>
		<category><![CDATA[USI]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=815</guid>
		<description><![CDATA[Before you start with SI, well I must say that as a prerequisite you must first read about the Primary index in Teradata. So after knowing about Primary index the point here is that when we already have UPI and NUPI then what’s the use of this Secondary Index? Well the best possible answer for &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=815">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Before you start with SI, well I must say that as a prerequisite you must first read about the <a href="http://www.teradatatech.com/?p=470" target="_blank">Primary index in Teradata</a>.<br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "ca-pub-5969102348498378";
/* 468x15, created 4/18/11 */
google_ad_slot = "2942595072";
google_ad_width = 468;
google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
So after knowing about Primary index the point here is that when we already have <strong>UPI</strong> and <strong>NUPI</strong> then what’s the use of this Secondary Index?</p>
<p>Well the best possible answer for this question is that &#8211; <span style="color: #0000ff;">Secondary Indexes provide an alternate path to the data, and should be used on queries that run many times.</span></p>
<p>Teradata runs extremely well without secondary indexes, but since secondary indexes use up space and overhead, they should only be used on &#8220;<strong>KNOWN QUERIES</strong>&#8221; or queries that are run over and over again. Once you know the data warehouse, environment you can create secondary indexes to enhance its performance.</p>
<p><span style="text-decoration: underline;"><strong>Syntax of creating Secondary Index</strong></span></p>
<p>Syntax of <strong>UNIQUE SI</strong>:</p>
<p><strong><span style="color: #800080;"><em>CREATE UNIQUE INDEX (Column/Columns) ON &lt;dbname&gt;.&lt;tablename &gt;;</em></span></strong></p>
<p>Syntax of <strong>NON-UNIQUE SI</strong>:</p>
<p><strong><em><span style="color: #800080;">CREATE INDEX (Column/Columns) ON &lt;dbname&gt;.&lt;tablename &gt;;</span></em></strong></p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;">Note</span></strong></span> &#8211; SI can be created even after table is populated with data. Unlike PI which is created only at the time of creation of table. You can create and drop SI at any time.</p>
<p>Whenever you create SI on the table, Teradata will create a subtable on all AMP. This subtable contains three columns given below –</p>
<ol>
<li><span style="color: #0000ff;">Secondary Index Value</span></li>
<li><span style="color: #0000ff;">Secondary Index Row ID (this is the hashed value of SI value)</span></li>
<li><span style="color: #0000ff;">Base table Row ID (this is the actual base row id  )</span></li>
</ol>
<p>Will see the use of all these values later in this post.</p>
<p><strong><span style="text-decoration: underline; color: #0000ff;">USI Subtable Example</span></strong></p>
<p>When we defined a UNIQUE SI on the table, then Teradata will immediately create a USI subtable in each AMP for that particular table.<br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "ca-pub-5969102348498378";
/* 250x250, created 4/18/11 */
google_ad_slot = "1252922097";
google_ad_width = 250;
google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
Remember creation of subtable requires <strong>PERM</strong> space, so always be wise to choose your SI. Normally the best SI is that column or columns which is mostly used in the <strong>WHERE</strong> clause.</p>
<p>Now I’ll explain in-depth architecture of creation of subtable and retrieval of SI for better understanding of the concept.</p>
<p>Please look into the image below -</p>
<p><a href="http://www.teradatatech.com/wp-content/uploads/2012/05/USI_EXAMPLE.jpg"><img class="alignnone  wp-image-816" style="border-image: initial; border-width: 1px; border-color: black; border-style: solid;" title="USI_EXAMPLE" src="http://www.teradatatech.com/wp-content/uploads/2012/05/USI_EXAMPLE.jpg" alt="" width="481" height="276" /></a></p>
<p>Suppose we have an Employee table (base table) having attributes <strong>Emp</strong>, <strong>Dept</strong> <strong>Fname</strong>, <strong>Lname</strong> and <strong>Soc_security</strong>. We defined USI on the column <strong><span style="color: #0000ff;">Soc_Security</span></strong>.</p>
<p>You can see the SI subtable created on each AMP which holds information about the SI column and corresponding Base row id (Base Table Row-ID), which is the ROW ID of the actual Employee table. The steps involve to load this subtable is as follows -</p>
<p>1)      Teradata will first create the subtable on all AMP.</p>
<p>2)      After that it hashes the value of this USI column (<strong><span style="color: #0000ff;">Soc_Security</span></strong>) and based on that hashed value it check the hash map for the AMP number which will hold this USI value in its subtable.</p>
<p>3)      After getting the respective AMP number, the SI value along with the two more attributes (<span style="color: #0000ff;">secondary index row id</span> and <span style="color: #0000ff;">base table row id</span>) will be stored in the subtable of that AMP.</p>
<p>In this way we populate our USI subtable on each AMP. As the SI columns is UNIQUE there is no duplication of SI values in any subtable, means each row in the subtable is unique and will fetch only one row when we make a query on that SI column.</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;">Note -</span></strong></span> As it is clear now that defining SI will require the creation of subtable, so we should be aware that SI requires space cost factor on our Teradata system.</p>
<p><span style="text-decoration: underline; color: #0000ff;">Teradata retrieval of USI query.</span></p>
<p>Suppose on the above example we make a query –</p>
<p><em><strong><span style="color: #800080;">Select * from Employee_table where Soc_Security = &#8217;123-99-8888&#8242;;</span></strong></em></p>
<p>When a TD optimizer finds USI in <strong>where</strong> clause it knows that it’s a 2 AMP operation and also only one row will be returned. So the step its perform for retrieval is as follows –</p>
<p>1)      It will hash the value of SI (<span style="color: #800080;">&#8217;123-99-8888&#8242;</span>), by hashing algorithm and found the hash value for it.</p>
<p>2)      Now it checks this hash value in the hash map and gets the AMP number from it. We know that this AMP stores this SI value.</p>
<p>3)      Now it will go to the Employee subtable of that AMP and retrieve the Base row id which is stored for that hash value.</p>
<p>4)      This Base row id will be sent back to optimizer by BYNET.</p>
<p>5)      Now optimizer sent back this ROW ID again and fetch the resultant row from the Base table for which <em>Soc_Security = &#8217;123-99-8888&#8242;</em> .</p>
<p>As we have seen that Teradata system requires <strong>2 AMP</strong> to reach the answer row that’s why we called USI operation as the <strong>2 AMP operations</strong>. Even if SI row resides in the same AMP  in which Base row reside , still after getting Base row id from the subtable it will sent back to optimizer so that it start search again based on that Base row id. <strong>So it’s always called as the 2 amp operation</strong>.</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;">NUSI Subtable Example</span></strong></span><strong> </strong></p>
<p>When we defined a NUSI on the table then Teradata will build the subtable on each AMP in the same fashion as that in USI. The only difference in this subtable creation is that, instead of building subtable on each AMP it will be build on <strong><span style="color: #0000ff;">AMP local</span></strong> which means that each AMP will build the subtable in it to points it own base rows. <span style="color: #0000ff;">In other words each NUSI subtable will reflect and points to the those base rows only which it owns.</span></p>
<p>Please look into the image below -<br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "ca-pub-5969102348498378";
/* 250x250, created 4/18/11 */
google_ad_slot = "1252922097";
google_ad_width = 250;
google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p><a href="http://www.teradatatech.com/wp-content/uploads/2012/05/NUSI_EXAMPLE.jpg"><img class="alignnone  wp-image-823" style="border-image: initial; border-width: 1px; border-color: black; border-style: solid;" title="NUSI_EXAMPLE" src="http://www.teradatatech.com/wp-content/uploads/2012/05/NUSI_EXAMPLE.jpg" alt="" width="485" height="279" /></a></p>
<p>Suppose we have an Employee table (base table) on which we defined NUSI on the column <strong><span style="color: #0000ff;">Fname</span></strong>.</p>
<p>1)      Now Teradata will first create the subtable on all AMP.</p>
<p>2)      Each AMP will hold the secondary index values for their rows in the base table only. In our example, each AMP holds the Fname column for all employee rows in the base table on their AMP (AMP local).</p>
<p>3)      Each AMP Local Fname will have the Base Table Row-ID (pointer) so the AMP can retrieve it quickly if needed. If an AMP contains duplicate first names, only one subtable row for that name is built with multiple Base Row-IDs. See the example above for the <span style="color: #0000ff;">Fname = ‘John’</span> , the subtable holds multiple base row id for this value.</p>
<p><span style="text-decoration: underline; color: #0000ff;">Teradata retrieval of USI query.</span></p>
<p>Suppose on the above example we make a query –</p>
<p><strong><em><span style="color: #800080;">Select * from Employee_table where Fname = ‘John’;</span></em></strong></p>
<p>When an NUSI (<span style="color: #0000ff;">Fname)</span> is used in the WHERE clause of an SQL statement, the PE Optimizer recognizes the Non-Unique Secondary Index. It will perform an all AMP operation to look into the subtable for the requested value. So the step its perform for retrieval is as follows –</p>
<p>1)      It will hash the value of NUSI <span style="color: #0000ff;">(‘John’)</span>, by hashing algorithm and found the hash value for it.</p>
<p>2)      Now it will instruct all AMP to look for this hash value in its Employee subtable. Note unlike USI there is no looking into hash map  because each subtable in the AMP contains rows from its own base rows only. So this look up on hash value will be performed on all AMP subtable.</p>
<p>3)       Any AMP which doesn&#8217;t have this hash value will not participate anymore in the operation.</p>
<p>4)      When the hash value found the corresponding Base row id will be fetched from the subtable and send to optimizer for actual retrieval of rows.</p>
<p><span style="color: #0000ff;">The point to note here is that NUSI operation is not similar to <strong>FTS (full table scan)</strong></span><span style="color: #0000ff;">.</span></p>
<p>Suppose we don’t have <span style="color: #0000ff;">Fname</span> as the NUSI and we make the query on <span style="color: #0000ff;">Fname</span> in <strong>WHERE</strong> clause. In this case first of all <span style="color: #0000ff;">Fname</span> from the Employee table is redistributed in <strong>SPOOL</strong> space and then we match our value given in the where clause from the rows in <strong>SPOOL</strong>.</p>
<p>While in our case where <span style="color: #0000ff;">Fname</span> is defined as NUSI, TD optimizer already knows that this column is NUSI and its already distributed by its value in subtable in each AMP. So it will not go for redistribution step instead of that it will directly match the value for it in each subtables.</p>
<p>The PE will decide if a NUSI is strongly selective and worth using over a Full Table Scan. So it’s advisable to always do <strong>COLLECT STATS</strong> on NUSI index. You can check the Explain function to see if a NUSI is being utilized or if bitmapping (FTS) is taking place.</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;"> Secondary Index Summary</span></strong></span><br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "ca-pub-5969102348498378";
/* 200x90, created 4/3/11 */
google_ad_slot = "8865605984";
google_ad_width = 200;
google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
1)      You can have up to <strong>32 secondary indexes</strong> for a table.</p>
<p>2)      Secondary Indexes provide an alternate path to the data.</p>
<p>3)      The two types of secondary indexes are <strong>USI</strong> and <strong>NUSI</strong>.</p>
<p>4)      Every secondary index defined causes each AMP to create a <strong>subtable</strong>.</p>
<p>5)      USI subtables are <strong>hash distributed</strong>.</p>
<p>6)      NUSI subtables are <strong>AMP local</strong>.</p>
<p>7)      USI queries are <strong>Two-AMP</strong> operations.</p>
<p>8)      NUSI queries are <strong>All-AMP</strong> operations, but not <strong>Full Table Scans</strong>.</p>
<p>9)      Always <strong>Collect Statistics</strong> on all <strong>NUSI</strong> indexes.</p>
<p>Any suggestions, corrections or enhancements to the post are most welcome <img src='http://www.teradatatech.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<script type="text/javascript">// <![CDATA[
google_ad_client = "ca-pub-5969102348498378";
/* 468x15, created 4/18/11 */
google_ad_slot = "2942595072";
google_ad_width = 468;
google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=815</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What is a pseudo table Lock in Explain Plan?</title>
		<link>http://www.teradatatech.com/?p=796</link>
		<comments>http://www.teradatatech.com/?p=796#comments</comments>
		<pubDate>Fri, 11 May 2012 19:09:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Tips]]></category>
		<category><![CDATA[explain plan]]></category>
		<category><![CDATA[pseudo lock]]></category>
		<category><![CDATA[pseudo table lock in teradata]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=796</guid>
		<description><![CDATA[When you want to retrieve the rows from the table, the very first step in explain plan is the pseudo table lock on that table e.g - Type select * from &#60;databasename&#62;.&#60;tablename&#62; in the SQL assistant, and do the explain plan for this table. The very first step you see is - 1) First, we lock &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=796">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>When you want to retrieve the rows from the table, the very first step in explain plan is the pseudo table lock on that table<br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 468x15, created 4/18/11 */
google_ad_slot = "2942595072";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
e.g -</p>
<p>Type <em><span style="color: #800080;">select * from &lt;databasename&gt;.&lt;tablename&gt;</span></em> in the SQL assistant, and do the explain plan for this table. The very first step you see is -</p>
<p><strong>1) First, we lock a distinct &lt;databasename&gt;.&#8221;pseudo table&#8221; for read on a</strong><br />
<strong> RowHash to prevent global deadlock for</strong><br />
<strong> &lt;databasename&gt;.&lt;tablename&gt;.</strong></p>
<p><strong>2)Next, we lock &lt;databasename&gt;.&lt;tablename&gt; for read.</strong></p>
<p>We know that for retrieval of rows from the table we need to put the read lock which we are implementing in step 2, but the question is that what is this <strong>pseudo table lock</strong> in the step 1 ?</p>
<p>We know that each AMP holds a portion of a table. We also know that when a Full Table Scan is performed that each AMP will read their portion of the table.</p>
<p>Now suppose that two different users wants to place multiple locks on the same table and one user gets one lock and the other user gets another lock. Both user requires lock made by other user and have to wait for indefinite time to acquire that lock because actually both the users are waiting for each other to release lock. This is called <strong><span style="color: #0000ff;">DEADLOCK</span></strong>.<br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 250x250, created 4/18/11 */
google_ad_slot = "1252922097";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<strong><span style="color: #0000ff;">A Pseudo Lock is how Teradata prevents a deadlock.</span></strong></p>
<p>When a user does an All-AMP operation Teradata will assign a single AMP to command the other AMPs to lock the table. We can call this AMP as the &#8220;<strong>Gatekeeper</strong>&#8221; AMP. This AMP will always be responsible for locking that particular table on all AMPs. Now all the users running an all AMP query on the table have to report to this &#8220;<strong>Gatekeeper</strong>&#8221; AMP for getting permission on locks.</p>
<p>The &#8220;Gatekeeper&#8221; AMP never plays favorites and performs the locking on a <strong>First Come First Serve basis</strong>. The first user to run the query will get the lock. The others will have to wait. In this way Teradata prevents the deadlock situation when an all AMP operation is made in the query<br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 200x90, created 4/3/11 */
google_ad_slot = "8865605984";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Note &#8211; Teradata selects this &#8220;Gatekeeper&#8221; AMP by hashing the tablename used in the select query and then matching the hash value in the hash map. The AMP number which it gets from hash map is assigned as &#8220;Gatekeeper&#8221; AMP.</p>
<p>Refer the image below taken from Coffings to understand the concept better -<br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 728x90, created 4/21/11 */
google_ad_slot = "8718274571";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<a href="http://www.teradatatech.com/wp-content/uploads/2012/05/img00580.gif"><img class="wp-image-797 aligncenter" title="img00580" src="http://www.teradatatech.com/wp-content/uploads/2012/05/img00580.gif" alt="" width="484" height="79" /></a><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 468x15, created 4/18/11 */
google_ad_slot = "2942595072";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=796</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SET or MULTISET tables</title>
		<link>http://www.teradatatech.com/?p=782</link>
		<comments>http://www.teradatatech.com/?p=782#comments</comments>
		<pubDate>Sat, 21 Apr 2012 16:35:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Tips]]></category>
		<category><![CDATA[multi set]]></category>
		<category><![CDATA[multi set in teradata]]></category>
		<category><![CDATA[multiset tables]]></category>
		<category><![CDATA[set and multiset]]></category>
		<category><![CDATA[set and multiset tables in teradata]]></category>
		<category><![CDATA[set in teradata]]></category>
		<category><![CDATA[set tables]]></category>
		<category><![CDATA[types of tables]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=782</guid>
		<description><![CDATA[We know that in Teradata all the tables are either SET or MULTISET. The difference between SET and MULTISET tables is –  SET tables – SET tables did not allow duplicate values in the table. e.g. COLUMN 1          COLUMN 2          COLUMN 3          COLUMN 4 A                            b                            c                            d H                           g                            y                            k A             &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=782">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
We know that in Teradata all the tables are either SET or MULTISET.</p>
<p>The difference between SET and MULTISET tables is –<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 250x250, created 4/18/11 */ google_ad_slot = "1252922097"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;"> SET tables</span></strong></span> – SET tables did not allow duplicate values in the table.</p>
<p><span style="text-decoration: underline;"><span style="color: #0000ff; text-decoration: underline;">e.g.</span></span></p>
<p><strong>COLUMN 1          COLUMN 2          COLUMN 3          COLUMN 4</strong></p>
<p><span style="color: #0000ff;">A                            b                            c                            d</span></p>
<p>H                           g                            y                            k</p>
<p><span style="color: #ff0000;">A                            b                            c                            d</span>             (<strong><span style="color: #ff0000;">Not allowed</span></strong>)</p>
<p><span style="text-decoration: underline;"><span style="color: #0000ff; text-decoration: underline;">Syntax</span></span></p>
<p><span style="color: #800080;">CREATE SET TABLE &lt;table_name&gt; &#8230;&#8230;&#8230;</span></p>
<p><span style="color: #800080;">&#8230;&#8230;&#8230;</span></p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff; text-decoration: underline;">MULTISET tables</span></strong></span> – MULTISET tables allow duplicate values in table.</p>
<p><span style="text-decoration: underline;"><span style="color: #0000ff; text-decoration: underline;">e.g.</span></span></p>
<p><strong>COLUMN 1          COLUMN 2          COLUMN 3          COLUMN 4</strong></p>
<p><span style="color: #0000ff;">A                            b                            c                            d</span></p>
<p>H                           g                            y                            k</p>
<p><span style="color: #008000;">A                            b                            c                            d </span>            (<strong><span style="color: #008000;">allowed</span></strong>)</p>
<p><span style="text-decoration: underline;"><span style="color: #0000ff; text-decoration: underline;">Syntax</span></span></p>
<p><span style="color: #800080;">CREATE MULTISET TABLE &lt;table_name&gt;&#8230;&#8230;&#8230;</span></p>
<p><span style="color: #800080;">&#8230;&#8230;&#8230;</span></p>
<p>If not specified in the DDL of the table then Teradata will create table as default SET. A SET table force Teradata to check for the duplicate rows every time a new row is <strong>inserted</strong> or <strong>updated</strong> in the table. This is an overhead on the resource if we need to insert massive amount of rows.</p>
<p><strong><span style="color: #0000ff;">Which table to choose?</span></strong></p>
<p>Before creating the table it’s very important to know what kind of data is required in the table and based on that we must define SET or MULTISET.<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 300x250, created 4/30/11 */ google_ad_slot = "1665025249"; google_ad_width = 300; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
Remember that SET table causes an additional overhead of checking for the duplicate records. So we need to follow few points to save Teradata from this additional overhead.</p>
<ul>
<li>If you are using any <strong><span style="color: #0000ff;">GROUP BY</span></strong> or <strong><span style="color: #0000ff;">QUALIFY</span></strong> statement on the source table then it’s highly recommended to define target table as MULTISET. As GROUP BY and QUALIFY will remove the duplicate records from the source.</li>
<li>If the source table has <strong><span style="color: #0000ff;">UPI (Unique Primary Index)</span></strong> then also there is no need of SET target table. As UPI will never allows duplicate PI in the same table.</li>
</ul>
<p>So with the help of little bit of awareness about SET and MULTISET we can save a lot of time while loading the table.<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 200x90, created 4/3/11 */ google_ad_slot = "8865605984"; google_ad_width = 200; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<strong><span style="color: #0000ff;">Key Points to remember.</span></strong></p>
<ul>
<li>If we are inserting data using <span style="color: #0000ff;"><em>INSERT into SEL from</em></span> clause then SET table check for duplicate rows will removed automatically and there <strong>will be no DUPLICATE ROW ERROR</strong>.</li>
<li>If we are inserting data using <span style="color: #0000ff;"><em>INSERT into VALUES</em></span> clause then SET table check for duplicate rows will not be removed automatically and there <strong>will be DUPLICATE ROW ERROR</strong>.</li>
</ul>
<p><script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=782</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Teradata 12 SQL Certification (TEO-122) &#8211; Sample paper 1</title>
		<link>http://www.teradatatech.com/?p=666</link>
		<comments>http://www.teradatatech.com/?p=666#comments</comments>
		<pubDate>Wed, 14 Mar 2012 06:47:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Certification Preparation]]></category>
		<category><![CDATA[free sql dumps teradata]]></category>
		<category><![CDATA[free teradata dumps]]></category>
		<category><![CDATA[teo 122]]></category>
		<category><![CDATA[teo122]]></category>
		<category><![CDATA[teradata 12 sql certification]]></category>
		<category><![CDATA[teradata sql]]></category>
		<category><![CDATA[teradata sql certification]]></category>
		<category><![CDATA[teradata sql dumps]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=666</guid>
		<description><![CDATA[Teradata database has become so popular today that you will often find many Teradata certification courses and online Teradata certification training resources. To become an Teradata Certified Professional, you will need to learn all the Teradata certification test objectives. Most of us are concern about the practice or sample questions for various Teradata exams. These &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=666">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
              google_ad_client = "pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p>Teradata database has become so popular today that you will often find many Teradata certification courses and online Teradata certification training resources.</p>
<p>To become an Teradata Certified Professional, you will need to learn all the Teradata certification test objectives. Most of us are concern about the practice or sample questions for various Teradata exams. These sample questions are beneficial in testing your knowledge and boost your confidence to appear for the real Exam.</p>
<p>I have collected few sample questions for the second exam of Teradata 12 certification i.e. <strong><span style="color: #0000ff;">TD SQL Exam (TEO-122)</span></strong></p>
<p>There are 15 questions, all of them focused on the SQL Exam only.</p>
<p>So those interested in certification have a look on the questions and rate yourself before appearing in TD certification.</p>
<p><strong>Click below link to start -</strong><br />
<script type="text/javascript">// <![CDATA[
       google_ad_client = "pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<script type="text/javascript">// <![CDATA[
       google_ad_client = "pub-5969102348498378"; /* 250x250, created 4/18/11 */ google_ad_slot = "1252922097"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<h5><span style="text-decoration: underline; color: #0000ff;"><strong><a href="http://www.teradatatech.com/?page_id=669"><span style="color: #0000ff; text-decoration: underline;">TD 12 SQL Exam (TEO-122) &#8211; Sample 1</span></a></strong></span></h5>
<p><script type="text/javascript">// <![CDATA[
       google_ad_client = "pub-5969102348498378"; /* 250x250, created 4/18/11 */ google_ad_slot = "1252922097"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<h6>You may also want to check below mentioned Sample Papers for completer reference -</h6>
<h6><script type="text/javascript"><!--
google_ad_client = "ca-pub-5969102348498378";
/* 200x90, created 4/3/11 */
google_ad_slot = "8865605984";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<a href="http://www.teradatatech.com/?p=325"><strong><span style="color: #0000ff;">TD 12 Basic Exam (TEO-121) &#8211; Sample 1</span></strong></a></h6>
<h6><span style="color: #0000ff;"><strong><a href="http://www.teradatatech.com/?p=511"><span style="color: #0000ff;">TD 12 Basic Exam (TEO-121) &#8211; Sample 2</span></a></strong></span></h6>
<p>I have also identified few E books which is immensely useful for Teradata Certification Preparation. Please have a look and if you are seriously preparing for TD certifications then don&#8217;t hesitate to purchase it.<span style="color: #0000ff;">(Hover the mouse on the below image to get more information about the book)</span></p>
<p>&nbsp;</p>
<table>
<tbody>
<tr>
<td><a href="http://www.amazon.com/gp/product/0970498098/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0970498098"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0970498098&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0970498098" alt="" width="1" height="1" border="0" /></td>
<td><a href="http://www.amazon.com/gp/product/0982087144/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0982087144"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0982087144&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0982087144" alt="" width="1" height="1" border="0" /></td>
<td><a href="http://www.amazon.com/gp/product/0983024219/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0983024219"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0983024219&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0983024219" alt="" width="1" height="1" border="0" /></td>
</tr>
</tbody>
</table>
<p><script type="text/javascript" src="http://wms.assoc-amazon.com/20070822/US/js/link-enhancer-common.js?tag=teradatatech-20">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p><noscript>&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;img src=&#8221;http://wms.assoc-amazon.com/20070822/US/img/noscript.gif?tag=teradatatech-20&#8243; alt=&#8221;" /&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br /&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;</noscript>&nbsp;</p>
<p><span style="color: #888888;">Disclaimer – These questions are collected from various sources on internet and teradatatech is not claiming for their occurrence in the real teradata certification exams. Please treat these questions as the practice set and test your knowledge accordingly.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=666</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Collision or Synonym in Teradata</title>
		<link>http://www.teradatatech.com/?p=633</link>
		<comments>http://www.teradatatech.com/?p=633#comments</comments>
		<pubDate>Fri, 24 Feb 2012 19:42:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Tips]]></category>
		<category><![CDATA[collision]]></category>
		<category><![CDATA[collision in teradata]]></category>
		<category><![CDATA[hash synonym]]></category>
		<category><![CDATA[hash synonym in teradata]]></category>
		<category><![CDATA[synonym in teradata]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=633</guid>
		<description><![CDATA[Teradata is consistent with hashing a value. It means that when Teradata hashes the Index value (e.g. ‘teradatatech’) it will come up with a Row Hash. Now if Teradata hashes the same index value (‘teradatatech’) million times it will always come up with the same Row Hash. Teradata always hashes the same value with consistent &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=633">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
Teradata is consistent with hashing a value. It means that when Teradata hashes the Index value (e.g. ‘teradatatech’) it will come up with a Row Hash. Now if Teradata hashes the same index value (‘teradatatech’) million times it will always come up with the same Row Hash. Teradata always hashes the same value with consistent results.</p>
<p>However, Teradata can hash two very different values and the result can sometimes be the same Row Hash. This is a called a <strong><span style="color: #0000ff;">Collision</span></strong>. It is sometimes called a <strong><span style="color: #0000ff;">Synonym</span></strong>.<br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 728x90, created 4/21/11 */ google_ad_slot = "8718274571"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
The AMP always double checks the Primary Index Value to insure it is getting the correct row. The AMP double checks because it is afraid if it does not it could get the wrong row because of a Collision!</p>
<p>Teradata searches for a Primary Index value by hashing the Primary Index Value and then using the Row Hash and the Hash Map to point to a specific AMP. The AMP then uses using a Binary Search of the Row Hash to find the row it is looking for.<br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 728x90, created 4/21/11 */ google_ad_slot = "8718274571"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
For e.g. we have the name ‘teradatatech’ and ‘teradata’ and that they both have the same Row Hash of 11000. <span style="color: #0000ff;">This is a collision</span>.<br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
This is why the AMP double checks. It finds ‘teradatatech’ with a binary search on 11000, but checks the value for integrity.<br />
<a href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=nitneo-"><img src="http://tracking.hostgator.com/img/Shared/300x250.gif" alt="" border="0" /></a></p>
<h3><strong><span style="color: #993366;">↓↓↓↓↓↓↓↓ SHARE IT WITH YOUR FRIENDS  </span></strong><span style="color: #993366;">↓↓↓↓↓↓↓↓</span></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=633</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Collect Statistics in Teradata</title>
		<link>http://www.teradatatech.com/?p=611</link>
		<comments>http://www.teradatatech.com/?p=611#comments</comments>
		<pubDate>Tue, 21 Feb 2012 15:57:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Basics]]></category>
		<category><![CDATA[collect statistics]]></category>
		<category><![CDATA[collect statistics in teradata]]></category>
		<category><![CDATA[collect statistics on teradata]]></category>
		<category><![CDATA[collect stats]]></category>
		<category><![CDATA[collect stats on table level]]></category>
		<category><![CDATA[collect stats teradata]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=611</guid>
		<description><![CDATA[Statistics are data demographics (or hints) used by the Teradata optimizer. There are many ways to generate a query plan for a given SQL, and collecting statistics ensures that the optimizer will have the most accurate information to create the best access and join plans. The optimizing phase of Teradata, makes decisions on how to &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=611">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Statistics are data demographics (or hints) used by the Teradata optimizer.<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
There are many ways to generate a query plan for a given SQL, and collecting statistics ensures that the optimizer will have the most accurate information to create the best access and join plans.</p>
<p>The optimizing phase of Teradata, makes decisions on how to access table data. These decisions can be very important when table joins (especially those involving multiple joins) are required by a query. By default, the Optimizer uses approximations of the number of rows in each table (known as the cardinality of the table) and of the number of unique values in indexes in making its decisions. To build such estimates, the Optimizer picks a random AMP and builds the information and it is possible for the estimates to be significantly off. This can lead to poor choices of join plans, and associated increases in the response times of the queries involved.</p>
<p>One way to help the Optimizer make better decisions is to give it more accurate information as to the content of the table. This can be done using the COLLECT STATISTICS statement. When the Optimizer finds that there are statistics available for a referenced table, it will use those statistics instead of using estimated table cardinality or estimated unique index value counts.</p>
<p><strong><span style="color: #0000ff;">Stats should be collected mainly under the below circumstances:</span></strong><br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 728x90, created 4/30/11 */ google_ad_slot = "1660989293"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
1. A thumb rule is to collect statistics when they&#8217;ve changed by 10%. (That would be 10% more rows inserted, or 10% of the rows deleted, or 10% of the rows changed, or some combination.)</p>
<p>2. The range of values for an index or column of a table for which statistics have been collected has changed significantly. Sometimes one can infer this from the date and time the statistics were last collected, or by the very nature of the column (for instance, if the column in question holds a transaction date, and statistics on that column were last gathered a year ago, it is almost certain that the statistics for that column are stale).</p>
<p><strong><span style="color: #0000ff;">How stats are built over the table?</span></strong><br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
TD builds the uniqueness count for each identified column / set of columns for the completed table/partition data and stores the information in the DBC tables.</p>
<p>Whenever the stats are collected later, the previously collected information is lost and fresh stats are updated in the DBC tables.</p>
<p>The time taken to collect stats doesn’t depend on how frequently the stats have been collected or how recently the stats have been collected.</p>
<p>Stats should be collected on all dimensions, history, transactional, reference and aggregate tables based on the below approach:<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 728x90, created 4/21/11 */ google_ad_slot = "8718274571"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
1. If the table is loaded under DELETE INSERT mode, then STATS should be collected during each load.</p>
<p>2. If the table is built under INSERT UPDATE mode, then STATS should be collected if the data demographics change by more than 10%.</p>
<p>3. If the target is a transactional table loaded in APPEND mode, then STATS should be collected if the data demographics change by more than 10%.</p>
<p>4. If the table is built under INSERT mode; (aggregate tables where data is built for a particular duration and queried upon this duration) tables where partitions are built over each aggregation period, STATS should be collected on the new partition, even if the data demographics for the entire table changes less than 10%, because user queries or extractions might be built over data for current period of aggregation.<br />
<script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<a href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=nitneo-"><img src="http://tracking.hostgator.com/img/Shared/300x250.gif" alt="" border="0" /></a></p>
<h3><strong><span style="color: #993366;">↓↓↓↓↓↓↓↓ SHARE IT WITH YOUR FRIENDS  </span></strong><span style="color: #993366;">↓↓↓↓↓↓↓↓</span></h3>
<h3></h3>
<h3></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=611</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Join Indexes</title>
		<link>http://www.teradatatech.com/?p=596</link>
		<comments>http://www.teradatatech.com/?p=596#comments</comments>
		<pubDate>Sun, 25 Dec 2011 11:43:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Basics]]></category>
		<category><![CDATA[join in teradata]]></category>
		<category><![CDATA[join index]]></category>
		<category><![CDATA[join index in teradata]]></category>
		<category><![CDATA[joins]]></category>
		<category><![CDATA[joins in teradata]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=596</guid>
		<description><![CDATA[The join index JOIN the two tables together and keeps the result set in the permanent space of Teradata. This JOIN index will hold the result set of the two table, and at the time of JOIN parsing engine will decide whether it is fast to build the result set from the actual BASE tables &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=596">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script><br />
The join index JOIN the two tables together and keeps the result set in the permanent space of Teradata. This JOIN index will hold the result set of the two table, and at the time of JOIN parsing engine will decide whether it is fast to build the result set from the actual BASE tables or the JOIN index. User never directly query the JOIN index. In the sense JOIN index is the result of joining two tables together so that parsing engine always decide to take the result set from this JOIN index instead of going and doing manual join on the base table.</p>
<p>Types of JOIN index -<br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378";/* 728x90, created 4/21/11 */google_ad_slot = "8718274571";google_ad_width = 728;google_ad_height = 90;
// ]]&gt;</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><strong><span style="text-decoration: underline; color: #0000ff;">Multi table JOIN index</span></strong></p>
<p><strong><span style="text-decoration: underline; color: #0000ff;"> </span></strong> Suppose we have two BASE tables EMPLOYEE_TABLE and DEP_TABLE, which holds the data of EMPLOYEE and DEPARTMENT respectively. Now a JOIN index on these two tables will be somewhat-</p>
<address style="text-align: left;"><strong><span style="color: #800080;">CREATE JOIN INDEX EMP_DEPT</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">AS</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">SELECT EMP_NO,EMP_NAME, EMP_DEPT, EMP_SAL, EMP_MGR</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">FROM EMPLOYEE_TABLE EMP</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">INNER JOIN DEP_TABLE DEP</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">ON EMP.EMP_DEPT = DEP.DEPT_NO</span></strong></address>
<address style="text-align: left;"><strong><span style="color: #800080;">UNIQUE PRIMARY INDEX (EMP_NO);</span></strong></address>
<address style="text-align: left;"> </address>
<p><span style="color: #000000;">This way the JOIN index EMP_DEPT holds the result set of two BASE tables, and at the time of JOIN PE will decide weather it is faster to join actual tables or to take result set from this JOIN index. So always choose wise list of columns and tables to create JOIN index.</span></p>
<p><span style="color: #000000;"> </span><strong><span style="color: #800080;"> </span> <span style="text-decoration: underline; color: #0000ff;">Single Table JOIN index</span></strong></p>
<p>A single table JOIN index duplicate a single table, but changes the primary index. Users will only query the base table and its PE who decide which result set is faster, from JOIN index or from actual BASE tables. The reason to create the single table JOIN index is so joins can be performed faster because no redistribution or duplication needs to occur.</p>
<address><strong><span style="color: #800080;">CREATE JOIN INDEX EMP_SNAP</span></strong></address>
<address><strong><span style="color: #800080;">AS </span></strong></address>
<address><strong><span style="color: #800080;">SELECT EMP_NO, EMP_NAME, EMO_DEPT</span></strong></address>
<address><strong><span style="color: #800080;">FROM EMPLOYEE_TABLE</span></strong></address>
<address><strong><span style="color: #800080;">PRIMARY INDEX(EMP_DEPT);</span></strong></address>
<address><strong><span style="color: #800080;"><br />
 </span></strong></address>
<p><strong><span style="text-decoration: underline;"><span style="color: #0000ff;">Aggregate JOIN index</span></span></strong></p>
<p><span style="text-decoration: underline;"> </span> An aggregate JOIN index will allow the tracking of Averages SUM and COUNT on any table. This JOIN index is basically used if we need to perform any aggregate function in the data of the table.</p>
<address><strong><span style="color: #800080;">CREATE JOIN INDEX AGG_TABLE</span></strong></address>
<address><strong><span style="color: #800080;">SEL </span></strong></address>
<address><strong><span style="color: #800080;">EMP_NO, </span></strong></address>
<address><strong><span style="color: #800080;">SUM(EMP_SAL)</span></strong></address>
<address><strong><span style="color: #800080;">FROM EMP_SALARY</span></strong></address>
<address><strong><span style="color: #800080;">GROUP BY 1;</span></strong></address>
<address><strong><span style="color: #800080;"><br />
 </span></strong></address>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378";/* 728x90, created 4/21/11 */google_ad_slot = "8718274571";google_ad_width = 728;google_ad_height = 90;
// ]]&gt;</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><strong>The main fundamentals of JOIN indexes are</strong> -</p>
<ul>
<li>JOIN index is not a pointer to data it actually store data in PERM space</li>
<li>Users never query them directly, its PE who decide which result set to take</li>
<li>Updated when base tables are changed</li>
<li>Can&#8217;t be loaded with Fastload or Multiload.</li>
<p>&nbsp;
</ul>
<p><script type="text/javascript">// <![CDATA[
  google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=596</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Teradata 12 Basics Certification (TEO-121) &#8211; Sample paper 2</title>
		<link>http://www.teradatatech.com/?p=511</link>
		<comments>http://www.teradatatech.com/?p=511#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:59:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Certification Preparation]]></category>
		<category><![CDATA[free teradata dumps]]></category>
		<category><![CDATA[TD 12 sample questions]]></category>
		<category><![CDATA[teradata]]></category>
		<category><![CDATA[teradata certification sample questions]]></category>
		<category><![CDATA[teradata dumps]]></category>
		<category><![CDATA[Terdata 12 certification]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=511</guid>
		<description><![CDATA[Teradata database has become so popular today that you will often find many Teradata certification courses and online Teradata certification training resources. To become an Teradata Certified Professional, you will need to learn all the Teradata certification test objectives. Most of us are concern about the practice or sample questions for various Teradata exams. These &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=511">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
            google_ad_client = "pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p>Teradata database has become so popular today that you will often find many Teradata certification courses and online Teradata certification training resources.</p>
<p>To become an Teradata Certified Professional, you will need to learn all the Teradata certification test objectives. Most of us are concern about the practice or sample questions for various Teradata exams. These sample questions are beneficial in testing your knowledge and boost your confidence to appear for the real Exam.</p>
<p>I have collected few sample questions for the first exam of Teradata 12 certification i.e. <strong><span style="color: #0000ff;">TD Basic Exam (TEO-121)</span></strong></p>
<p>There are 15 questions, all of them focused on the Basic Exam only.</p>
<p>So those interested in certification have a look on the questions and rate yourself before appearing in TD certification.</p>
<p><strong>Click below link to start -</strong><br />
<script type="text/javascript">// <![CDATA[
     google_ad_client = "pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<script type="text/javascript">// <![CDATA[
     google_ad_client = "pub-5969102348498378"; /* 250x250, created 4/18/11 */ google_ad_slot = "1252922097"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<h5><span style="text-decoration: underline;"><a href="http://www.teradatatech.com/?page_id=515"><strong><span style="color: #0000ff;">TD 12 Basic Exam (TEO-121) &#8211; Sample 2</span></strong></a></span></h5>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 728x90, created 4/21/11 */ google_ad_slot = "0062004957"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<h6>You may also want to check below mentioned Sample Papers for completer reference -</h6>
<h6><script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 200x90, created 4/3/11 */ google_ad_slot = "8865605984"; google_ad_width = 200; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
<span style="text-decoration: underline;"><a href="http://www.teradatatech.com/?p=325"><strong><span style="color: #0000ff;">TD 12 Basic Exam (TEO-121) &#8211; Sample 1</span></strong></a></span></h6>
<h6><span style="text-decoration: underline;"><strong><span style="color: #0000ff;"><a href="http://www.teradatatech.com/?p=666"><span style="color: #0000ff; text-decoration: underline;">TD 12 SQL Exam (TEO-122) &#8211; Sample 1</span></a></span></strong></span></h6>
<p>I have also identified few E books which is immensely useful for Teradata Certification Preparation. Please have a look and if you are seriously preparing for TD certifications then don&#8217;t hesitate to purchase it.<span style="color: #0000ff;">(Hover the mouse on the below image to get more information about the book)</span></p>
<p>&nbsp;</p>
<table>
<tbody>
<tr>
<td><a href="http://www.amazon.com/gp/product/0970498098/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0970498098"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0970498098&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0970498098" alt="" width="1" height="1" border="0" /></td>
<td><a href="http://www.amazon.com/gp/product/0982087144/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0982087144"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0982087144&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0982087144" alt="" width="1" height="1" border="0" /></td>
<td><a href="http://www.amazon.com/gp/product/0983024219/ref=as_li_tf_il?ie=UTF8&amp;tag=teradatatech-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0983024219"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL110_&amp;ASIN=0983024219&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=teradatatech-20&amp;ServiceVersion=20070822" alt="" border="0" /></a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=teradatatech-20&amp;l=as2&amp;o=1&amp;a=0983024219" alt="" width="1" height="1" border="0" /></td>
</tr>
</tbody>
</table>
<p><script type="text/javascript" src="http://wms.assoc-amazon.com/20070822/US/js/link-enhancer-common.js?tag=teradatatech-20">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p><noscript>&amp;amp;amp;amp;amp;amp;amp;lt;img src=&#8221;http://wms.assoc-amazon.com/20070822/US/img/noscript.gif?tag=teradatatech-20&#8243; alt=&#8221;" /&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;br /&amp;amp;amp;amp;amp;amp;amp;gt;</noscript>&nbsp;</p>
<p><span style="color: #888888;">Disclaimer – These questions are collected from various sources on internet and teradatatech is not claiming for their occurrence in the real teradata certification exams. Please treat these questions as the practice set and test your knowledge accordingly.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=511</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Primary Index in Teradata</title>
		<link>http://www.teradatatech.com/?p=470</link>
		<comments>http://www.teradatatech.com/?p=470#comments</comments>
		<pubDate>Sun, 20 Nov 2011 14:21:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Basics]]></category>
		<category><![CDATA[hashing algorithm]]></category>
		<category><![CDATA[hashing in teradata]]></category>
		<category><![CDATA[NUPI]]></category>
		<category><![CDATA[primary index]]></category>
		<category><![CDATA[row hash value]]></category>
		<category><![CDATA[UPI]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=470</guid>
		<description><![CDATA[Each table in Teradata is required to have a primary index.Even if you did not define any primary index in CREATE table statement, the Teradata system will automatically takes very first column of the table as the primary index. The primary index defines where data will reside and which AMP receives the row. The three &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=470">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Each table in Teradata is required to have a primary index.Even if you did not define any primary index in CREATE table statement, the Teradata system will automatically takes very first column of the table as the primary index. The primary index defines where data will reside and which AMP receives the row.</p>
<p><strong>The three most important roles the primary index does is the following –</strong><br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<ul>
<li>Data Distribution</li>
<li>Fastest way to retrieve Data</li>
<li>Incredibly important for Joins</li>
</ul>
<p><span style="color: #0000ff;">In short primary index provides the fastest physical path to retrieving data.</span></p>
<p>Two types of Primary Indexes are given below  –<br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* new text ad in index */ google_ad_slot = "1545016026"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p><strong><span style="text-decoration: underline; color: #0000ff;">Unique Primary Index (UPI)</span></strong></p>
<p>A unique primary index means that the value for the selected column must be unique.  In the example below the <strong><span style="color: #000000;">EMP_ID</span></strong> is the Unique Primary Index.</p>
<p><img class="size-full wp-image-471 alignnone" style="border: 1px solid black;" title="first_table" src="http://www.teradatatech.com/wp-content/uploads/2011/11/first_table.jpg" alt="" width="500" height="127" /></p>
<p><span style="color: #ff0000;">A unique primary index (UPI) will always spread the rows of the table evenly amongst the AMPs.</span></p>
<p><strong><span style="text-decoration: underline; color: #0000ff;">Non Unique Primary Index (NUPI)</span></strong></p>
<p><span style="color: #000000;">A Non unique primary index means that the value for the selected column can be non unique.  In the example below the <strong>LAST_NAME</strong> is the Non Unique Primary Index.</span></p>
<p><img class="alignnone size-full wp-image-472" title="second_table" src="http://www.teradatatech.com/wp-content/uploads/2011/11/second_table.jpg" alt="" width="500" height="129" /></p>
<div style="text-align: left;"><span style="color: #ff0000;">A Non Unique Primary Index (NUPI) will almost never spread the rows of the table evenly amongst the AMPs.</span></div>
<p><em>Key Point - Don’t assume that UPI is always the BEST CHOICE; sometimes the use of NUPI is very critical. If you need to perform lot of query with LAST_NAME in the WHERE clause then NUPI on last name is essential.</em></p>
<p><strong><span style="text-decoration: underline; color: #0000ff;">Primary Index and the ROW HASH</span></strong><br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* new text ad in index 250 */ google_ad_slot = "0306587388"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
The primary index is the key to determine where the ROW of the table will reside on which AMP. When a new row arrive for insert in Teradata the following steps occur –</p>
<ol>
<li>Teradata <strong>Parsing Engine</strong> (PE) examines the primary index of the row.</li>
<li>Teradata takes the primary index of the rows and run it through <strong>HASHING ALGORITHM</strong>.</li>
<li>The output of the Hashing Algorithm is the <strong>32 bit Row – Hash value</strong>.</li>
</ol>
<p>e.g –</p>
<p>New row coming with following attributes -</p>
<p style="text-align: left;"><span style="font-size: small;"><span style="line-height: normal;"><img class="alignnone size-full wp-image-473" title="third_table" src="http://www.teradatatech.com/wp-content/uploads/2011/11/third_table.jpg" alt="" width="500" height="53" /><br />
</span></span></p>
<p><strong>Hash the PI value</strong> -&gt; <span style="color: #0000ff;">55 / HASHING ALGORITHM = <strong><span style="color: #800080;">11110000111100001111000011110000</span></strong> (Row – Hash)</span></p>
<p>This value in Binary format is called as the Row – Hash Value. And it will always be unique for the given PI. Means it’s not possible to get two Row – Hash Value for the same EMP_ID (55).</p>
<p>This 32 bit Row &#8211; Hash value determines in which AMP the row will reside and it always attached along with the ROW to make it a UNIQUE identification for that ROW.</p>
<p>Now in Teradata we have <strong>HASH MAP</strong> which contains the different bucket called as <strong>Hash Map Buckets.</strong> These buckets contain only the different AMP number which is attached with the Teradata system. Suppose that Teradata system contains 4 AMP then this Hash Map contains numbers from 1 to 4 in different buckets. see image below -</p>
<p><img class="size-full wp-image-474 aligncenter" style="border: 2px solid black;" title="hash_map" src="http://www.teradatatech.com/wp-content/uploads/2011/11/hash_map.jpg" alt="" width="500" height="132" /></p>
<p style="text-align: center;"><strong> <span style="text-decoration: underline;">Four Amp Hash Map</span></strong></p>
<p>&nbsp;</p>
<p>The Row – hash value which we determine above,  is used to point to certain bucket in the Hash Map. This value points to only one bucket in the Hash Map and that bucket number will determine the AMP number where this new row will reside.</p>
<p>e.g. –</p>
<p><strong><span style="color: #800080;">11110000111100001111000011110000</span> </strong>tells that it correspond to first row and fourth column of Hash Map i.e. <strong>AMP no = 4</strong></p>
<p>So finally we have the AMP number (4) where the new row will reside.</p>
<p>After doing all this calculation in PE , the PE instruct BYNET to send the row along with its unique Row – Hash Value in the AMP number 4.</p>
<p><img class="alignnone size-full wp-image-475" style="border: 1px solid black;" title="fourth_table" src="http://www.teradatatech.com/wp-content/uploads/2011/11/fourth_table.jpg" alt="" width="508" height="50" /></p>
<p>The new row along with its Row hash Value is send to AMP number 4 for storing. In this way we achieve the data distribution for each row of the given table.</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #0000ff;">Uniqueness value</span></strong></span><br />
<script type="text/javascript">// <![CDATA[
 google_ad_client = "ca-pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script><br />
When the AMP receives the row it will place the row into the proper table, and the AMP itself check that is there any other row with the same Row- Hash Value. If this is the first Row with the particular Row- Hash value then it will assign a <strong>uniqueness value of 1</strong> along with the row. But if this is the second row with the same Row-Hash value for the same table then it will assign a <strong>uniqueness value of 2</strong>. Similarly it assign a value of 3 if it finds third occurrence of the same Row – Hash, in this fashion it keeps on adding uniqueness value for the duplicates rows.</p>
<p>If you don’t get this concept at the first go don’t worry, it is explained again with the suitable examples for more clarity.</p>
<p><span style="color: #0000ff;">An example of UPI table, where <strong>EMP_ID</strong> is the UPI.</span></p>
<p style="text-align: left;"><span style="font-size: small;"><span style="line-height: normal;"><img class="alignnone size-full wp-image-476" title="Uniqu1" src="http://www.teradatatech.com/wp-content/uploads/2011/11/Uniqu1.jpg" alt="" width="500" height="129" /><br />
</span></span></p>
<p><span style="text-decoration: underline;"><strong>Note</strong></span> – as the table has UPI defined on EMP_ID it will always has the unique row in the given table. So each time AMP will assign the uniqueness value of 1 against each row.</p>
<p><span style="color: #0000ff;">An example of NUPI table, where <strong>LAST_NAME</strong> is the NUPI.</span></p>
<p style="text-align: left;"><span style="font-size: small;"><span style="line-height: normal;"><a href="http://www.teradatatech.com/wp-content/uploads/2011/11/last_table.jpg"><img class="alignnone size-full wp-image-495" style="border: 1px solid black;" title="last_table" src="http://www.teradatatech.com/wp-content/uploads/2011/11/last_table.jpg" alt="" width="500" height="123" /></a><br />
</span></span></p>
<p><span style="text-decoration: underline;"><strong>Note</strong></span> – as the table has NUPI defined on LAST_NAME, we have three rows for the same LAST_NAME = ‘Kumar’. Hence the AMP will assign different uniqueness value from 1 t 3 for each row.</p>
<p>Together with Row – Hash and the uniqueness value the Teradata make as <strong>64 bit ROW – ID</strong> to uniquely identify each row in the given AMP.</p>
<p>This is the complete reference for Primary Index in Teradata. I tried to make it as simple as possible for the newbies, in case of any correction or clarification feel free to reach  me <img src='http://www.teradatatech.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To read about Secondary index in teradata please go to &#8211; <a href="http://www.teradatatech.com/?p=815" target="_blank">Secondary Index in Teradata</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=470</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Collecting Stats on Table Level or Column Level ?</title>
		<link>http://www.teradatatech.com/?p=430</link>
		<comments>http://www.teradatatech.com/?p=430#comments</comments>
		<pubDate>Wed, 03 Aug 2011 14:54:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TD Tips]]></category>
		<category><![CDATA[collect stats]]></category>
		<category><![CDATA[collect stats on column level]]></category>
		<category><![CDATA[collect stats on table level]]></category>
		<category><![CDATA[collect stats teradata]]></category>

		<guid isPermaLink="false">http://www.teradatatech.com/?p=430</guid>
		<description><![CDATA[COLLECT STATS is one on the most useful utility in Teradata. It helps Parsing Engine (PE) to make an effective plan to execute query, so that less resource are utilized and performance is improvised. But there is a serious confusion between doing COLLECT STATS on column level or table level. Here i like to explain &#8230; </p><p><a class="more-link block-button" href="http://www.teradatatech.com/?p=430">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "pub-5969102348498378"; /* 468x15, created 4/18/11 */ google_ad_slot = "2942595072"; google_ad_width = 468; google_ad_height = 15;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p>COLLECT STATS is one on the most useful utility in Teradata. It helps <strong>Parsing Engine (PE)</strong> to make an effective plan to execute query, so that less resource are utilized and performance is improvised.</p>
<p>But there is a serious confusion between doing COLLECT STATS on <strong>column level</strong> or <strong>table level</strong>.</p>
<p>Here i like to explain the difference between both the scenarios with appropriate example.</p>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "pub-5969102348498378"; /* 468x60, created 3/17/11 */ google_ad_slot = "8309277665"; google_ad_width = 468; google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p>Suppose we have a table and we want to collect statistics on 4 columns. We can do this by the below mentioned query -</p>
<p><strong><span style="color: #0000ff;">collect stats on TABLE_NAME column(COL1);<br />
collect stats on TABLE_NAME column(COL2);<br />
collect stats on TABLE_NAME column(COL3);<br />
collect stats on TABLE_NAME </span></strong><span><strong><span style="color: #0000ff;">column(COL4);</span></strong></span></p>
<p>The other way of defining COLLECT STATS on the same table is -</p>
<p><strong><span style="color: #0000ff;">collect stats on TABLE_NAME;</span></strong></p>
<p>The second query is collecting stats on table level. Both the approach will do the same thing, but we cannot directly collect stats on  table level.</p>
<p>If you are collecting STATS on table level, then the STATS must already be defined on the above mentioned 4 columns of the table. This can be done at the time of creation of table. If we are not defining the STATS for the columns earlier, then our COLLECT STATS on table level will give an <strong>error message</strong>.</p>
<p>Collect stats on table can only be used on a table which has stats defined on it, on any no. of columns for that be. Once stats are defined on the columns you can you use collect stats on table for refresh the stats for all the defined columns. If you use <strong>collect stats on TABLE_NAME column(COL1) </strong>it will refresh the stats on the mentioned column (COL1) only.</p>
<p><script type="text/javascript">// <![CDATA[
 google_ad_client = "pub-5969102348498378"; /* 728x90, created 4/21/11 */ google_ad_slot = "0062004957"; google_ad_width = 728; google_ad_height = 90;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p>We can say that COLLECT STATS on table level is just the shortcut of collecting stats on all the columns on whom we have already defined stats. It saves the overhead of writing COLLECT STATS query on each column, each time we want to gather statistics. In our case there are only 4 columns whose statistics we want, but  suppose in a huge table if there are more than 10-20 columns which are  required for COLLECT STATS, then our COLLECT STATS on table level saves  us a lot of typing time. Its good practice to perform a collect stats on the columns of even an empty table, when data is loaded into the table a collect stats on table can be used to collect all the statistics without having to collect statistics on the individual columns.</p>
<p>But from a <strong>DBA </strong>point of view its always wise to collect stats on column level. Because if we are doing collect stats on TABLE level then stats are not committed on any column until all stats are collected. Since collecting stats required resources, so if you have huge data table then it might take a long time. If you need to free the resource then you have to abort the whole process, and no stats will be collected on any column.On the other hand if your are doing it on COLUMN level, and killed the process in between then atleast we have stats collected on columns which are already done before killing the script. And we can again start from that column where we left.</p>
<p>So these are the pros and cons of both the approach of collecting stats. Its according to the requirement of the project, which approach to choose</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teradatatech.com/?feed=rss2&#038;p=430</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

