Vous êtes sur la page 1sur 3

How do you join the data from multiple Data Marts ? if so what would be the...

Hi One way of connecting data from multiple datamarts is with the use of confirmed dimensions Confirmed dimensions are dimensions which are shared between multiple fact tables within a datamart or between multiple datamarts For example: We have a company which provides banking and insurance solutions to customers so one customer would have entry in banking datamart,credit card and insurance so if we create a customer dimension with client id,customer id or party id. then we can join multiple datamarts using this ID.

How to eliminate Product Joins in a Teradata SQL query?


How to eliminate Product Joins in a Teradata SQL query? Answers: 1. Ensure statistics are collected on join columns and this is especially important if the columns you are joining on are not unique. 2. Make sure you are referencing the correct alias. 3. Also, if you have an alias, you must always reference it instead of a fully qualified tablename. 4. Sometimes product joins happen for a good reason. Joining a small table (100 rows) to a large table (1 million rows) a product join does make sense.

What is a join index ? What are benefits of using Join index?


Answer: It is a index that is maintained in a system .It maintains rows joined on two or more tables. Join index is useful for queries where the index structure contains all the columns referenced by one or more joins, thereby allowing the index to cover all or part of the query Benefits if using join index is - to eliminate base table access - Aggregate processing is eliminated by creating aggregate join index - It reduces redistribution of data since data is materialized by JI. - Reduces complex join conditions by using covering queries

What are different types of Spaces available in Teradata ?

There are 3 types of Spaces available in teradata ,they are 1. Perm space -This is disk space used for storing user data rows in any tables located on the database. -Both Users & databases can be given perm space. -This Space is not pre-allocated , it is used up when the data rows are stored on disk. 2.Spool Space -It is a temporary workspace which is used for processing Rows for given SQL statements. -Spool space is assigned only to users . -Once the SQL processing is complete the spool is freed and given to some other query. -Unused Perm space is automatically available for Spool . 3. TEMP space -It is allocated to any databases/users where Global temporary tables are created and data is stored in them. -Unused perm space is available for TEMP space

How to find duplicates in a table?


To find duplicates in the table , we can use group by function on those columns which are to be used and then listing them if their count is >1 . Following sample query can be used to find duplicates in table having 3 columns select col1, col2,col3, count(*) from table group by col1, col2, col3 having count (*) > 1 ;

What are Restrictions on Views in Teradata?


An index cannot be Created on a view. It cannot contain an ORDER BY clause. All the derived columns and aggregate columns used in the view must have an AS clause (alias defined). A view cannot be used to UPDATE if it contains the following : Data from more than one table (JOIN VIEW) The same column twice Derived columns A DISTINCT clause A GROUP BY clause

What are the reasons for product joins ?


1. Stale or no stats causing optimizer to use product join 2. Improper usage of aliases in the query. 3. missing where clause ( or Cartesian product join 1=1 ) 4. non equality conditions like > ,< , between example ( date) 5. few join conditions 6. when or conditions are used.

How do you whether table is locked or not?


Just run the following query on the table. Lock Table DBNAME.TABLENAME write nowait Select * from DBNAME.TABLENAME; If this table is locked currently then , then the above statement would fail as Nowait will not wait for locks to be released on that table

What are advantages of compression on tables?


- They take less physical space then uncompressed columns hence reducing space cost - They improve system performance as less data will be retrieved per row fetched , more data is fetched per data block thus increasing data loading speed - They reduce overall I/O

What are the advantages and dis-advantages of secondary Indexes?


What are the advantages and dis-advantages of secondary Indexes? Answer: Advantages: 1. A secondary index might be created and dropped dynamically 2.A table may have up to 32 secondary indexes. 3. Secondary index can be created on any column. .Either Unique or Non-Unique 4. It is used as alternate path or Least frequently used cases. ex. defining SI on non indexed column can improve the performance, if it is used in join or filter condition of a given query. 5. Collecting Statistics on SI columns make sure Optimizer choses SI if it is better than doing Full Table Scans Disadvantages 1. Since Sub tables are to be created, there is always an overhead for additional spaces. 2. They require additional I/Os to maintain their sub tables. 3. The Optimizer may, or may not, use a NUSI, depending on its selectivity. 4. If the base table is Fallback, the secondary index sub table is Fallback as well. 5. If statistics are not collected accordingly, then the optimizer would go for Full Table Scan.

Vous aimerez peut-être aussi