<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating Teradata Database Tables Using Proc SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582603#M165732</link>
    <description>&lt;P&gt;Ok, well, I'll say that this part of the process is concerning:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;In fact it seems that in most cases we are just picking 4 or 5 variables that we think have the greatest number of distinct values and putting them in as parameters to this option.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't always need indexes, but when you do have indexes, they should be on variables that are likely to be used as filters or joins.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at queries to see what the JOIN ON key variables are and which variables are likely to be used usually requires knowledge of the data and/subject matter. For example for a health care data base, you're likely pulling by dates, by facility of service or by diagnosis types for starters. You likely don't want indexes on patient ID because that's too unique and you index will be almost as big as your main data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll probably need to expand on your question and how it relates to Teradata because that's still not clear IMO. That being said, i haven't worked on Teradata, just DB2, MS SQL and Oracle. so feel free to ignore me!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 21:18:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-08-20T21:18:10Z</dc:date>
    <item>
      <title>Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582592#M165721</link>
      <description>&lt;P&gt;I'm not sure if we have any Teradata database folks out there, but if we do I have a question for you...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my project we create Teradata database tables via Proc SQL using the 'Primary Index' option? For example: (FASTLOAD=YES DBCREATE_TABLE_OPTS='PRIMARY INDEX (var1 var2 var3 var4 var5)')?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems to me that most of our Teradata tables do not have a large enough number of rows that they would require a primary index, a pre-sort that would benefit us in speed/efficiency, when later querying or joining to these tables later in our SAS programs. In fact it seems that in most cases we are just picking 4 or 5 variables that we think have the greatest number of distinct values and putting them in as parameters to this option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just curious if any of you might know why we do this when creating Teradata tables?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 20:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582592#M165721</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-20T20:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582594#M165723</link>
      <description>Are you asking for the logic of why indexes are created that way in teradata?&lt;BR /&gt;&lt;BR /&gt;Indexes aren't just a teradata concept so it would be a generic question if that's the case.</description>
      <pubDate>Tue, 20 Aug 2019 21:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582594#M165723</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582602#M165731</link>
      <description>Specifically to TeraData as I think it might have some impact on table&lt;BR /&gt;storage across Amps (processors) - I think &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582602#M165731</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-20T21:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582603#M165732</link>
      <description>&lt;P&gt;Ok, well, I'll say that this part of the process is concerning:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;In fact it seems that in most cases we are just picking 4 or 5 variables that we think have the greatest number of distinct values and putting them in as parameters to this option.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't always need indexes, but when you do have indexes, they should be on variables that are likely to be used as filters or joins.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at queries to see what the JOIN ON key variables are and which variables are likely to be used usually requires knowledge of the data and/subject matter. For example for a health care data base, you're likely pulling by dates, by facility of service or by diagnosis types for starters. You likely don't want indexes on patient ID because that's too unique and you index will be almost as big as your main data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll probably need to expand on your question and how it relates to Teradata because that's still not clear IMO. That being said, i haven't worked on Teradata, just DB2, MS SQL and Oracle. so feel free to ignore me!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582603#M165732</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582604#M165733</link>
      <description>&lt;P&gt;However you bring up another separate question for this novice...at what point, in terms of number of rows, does it make sense to index a database table (any database) or SAS dataset?&amp;nbsp; Is there a magic number (e.g. &amp;gt; 20 million rows)?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582604#M165733</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-20T21:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582606#M165735</link>
      <description>&lt;P&gt;There's no hard and fast rule, and in fact it will almost certainly be related to what type of hardware you're running on. For example if you're using In memory tech, I'm not sure indices are as relevant or even possible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can search the topic at LexJansen.com and find many examples.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honestly, I usually start creating indexes for things that start hitting over 2 million and/or when I start running into issues with speed and want faster performance. But we're often doing things a bit more on the fly than strategically &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;However you bring up another separate question for this novice...at what point, in terms of number of rows, does it make sense to index a database table (any database) or SAS dataset?&amp;nbsp; Is there a magic number (e.g. &amp;gt; 20 million rows)?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582606#M165735</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582609#M165737</link>
      <description>&lt;P&gt;One term I keep hearing is table 'skewness'.&amp;nbsp; I'm not sure I fully understand how that would relate to indexing teradata tables.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582609#M165737</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-20T21:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582611#M165739</link>
      <description>&lt;P&gt;It means you have data where a few filters or criteria will capture most of the data and a lot of outliers. I suspect that has to do with the distribution of the index variable and making a decision on whether to use it or not. But it's an educated guess at best &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do some reading on general indexes, I think that part may make more sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/582611#M165739</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/583883#M166248</link>
      <description>&lt;P&gt;Ok, so I've found that the reason we create these indexes is to evenly distribute the teradata table across processors (or AMPs).&amp;nbsp; This is apparently a Teradata-specific storage 'thing'.&amp;nbsp; So my follow up question would be are there cases when creating indexes (on teradata or otherwise) are inefficient?&amp;nbsp;&amp;nbsp;I ask because there is a new Teradata option where I can specify&amp;nbsp;&lt;SPAN&gt;DBCREATE_TABLE_OPTS='NO PRIMARY INDEX' which randomly spreads the table across processors without creating a primary index.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this is the case then perhaps in some instances we are creating teradata tables with indexes that aren't specifically targeting how the table will be queried later in the program.&amp;nbsp; This would be inefficient, right?&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Also doesn't the creation of an index take resources in itself?&amp;nbsp; Like isn't the database having to sort the table?&amp;nbsp; Or is the index itself and object on the database that takes up space resources?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 12:51:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/583883#M166248</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-26T12:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/583946#M166272</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If this is the case then perhaps in some instances we are creating teradata tables with indexes that aren't specifically targeting how the table will be queried later in the program.&amp;nbsp; This would be inefficient, right?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, indexes take up space and creating/maintaining indexes is work&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Also doesn't the creation of an index take resources in itself?&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Yes&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Like isn't the database having to sort the table?&amp;nbsp; Or is the index itself and object on the database that takes up space resources&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Indexes are essentially objects. I like to think of a DB as a really large textbook. The index is the table of glossary at the back which has the key words and you can search by the word in the back and know exactly what page you need to jump to in the DB. I don't consider it the Table of Contents because that's manually curated, whereas an index is more a data driven approach and doesn't order based on context but follows a series of rules. It takes up resources to create, store, maintian and use an index. There are cases where an index can decrease efficiency - you'll need to test for your use cases.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That all being said, RDBMS are starting to get a lot better at storage and retrieval and some of the new tech is meaning that everything is in memory so indices may not be as useful in those cases. You have to consider your data storage, retrieval and usage when deciding which may be the best approach. And this is why data architects still have jobs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 15:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/583946#M166272</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-26T15:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584094#M166300</link>
      <description>Are indexes equal in size/space to the table?  Are they simply a separate,&lt;BR /&gt;sorted version of the table?&lt;BR /&gt;&lt;BR /&gt;I think when sorting a sas dataset that sas creates a temporary version of&lt;BR /&gt;the table that I think is the same size of the table being sorted - however&lt;BR /&gt;it's only a temporary table and is removed when the sort is completed I&lt;BR /&gt;think.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Aug 2019 22:47:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584094#M166300</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2019-08-26T22:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584106#M166303</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;EM&gt;&amp;gt;&amp;nbsp;For example if you're using In memory tech, I'm not sure indices are as relevant or even possible.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In my experience, loading a data set in memory using SASFILE will conserve the usability of existing indexes, and these indexes still help a lot speeding up random reads.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 01:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584106#M166303</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-27T01:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Teradata Database Tables Using Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584117#M166304</link>
      <description>&lt;P&gt;Tradition RDMS indexes have nothing to do with Teradata's PRIMARY INDEX.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you have stated Teradata will distribute the data to the AMPS (logical processing units that provide massive parallelism that make TD queries run so fast). You want all of the related data together on the same AMP so that cross AMP communication is reduced.&amp;nbsp; You want to avoid SKEWing the data so that each AMP has approximately the same amount of data to process.&amp;nbsp; Again this makes the queries run faster and the avoids overloading one AMP so that it runs out of storage even while the other AMPs have plenty of space to load more data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that do NOT have to define a PRIMARY INDEX.&amp;nbsp; You can let Teradata distribute the data across the AMPS randomly.&amp;nbsp; Unless you are running a very old version of Teradata.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Deciding what variable(s) to use as the PRIMARY INDEX is probably more of an art than a science.&amp;nbsp; But I am sure your Teradata support team can help you with any specific tables that you want to analyze and suggest how to proceed.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2019 02:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Teradata-Database-Tables-Using-Proc-SQL/m-p/584117#M166304</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-27T02:29:57Z</dc:date>
    </item>
  </channel>
</rss>

