Category: TD Tips

Collecting Stats on Table Level or Column Level ?

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 …

Continue reading

Query to find Table Space Utilization in Database

This is the query to find the amount of space which each table occupy in there respective Database. SELECT DATABASENAME (TITLE ‘Database’) ,TABLENAME (TITLE ‘Table Name’) ,SUM(CURRENTPERM)/(1024*1024*1024)  (DECIMAL(15,6))  (TITLE ‘Current Perm Space(GB)’) FROM DBC.TABLESIZE WHERE DATABASENAME = ‘YOUR_DATABASE_NAME‘ GROUP BY 1,2 ORDER BY 3 DESC Where ‘YOUR_DATABASE_NAME‘ is the name of the database for which …

Continue reading

Query to find Database Space Utilization in Teradata

Space allocation is the most primary and important part in any Database. Teradata gives us the unique set of System Tables, with the help of which, we can do some useful space allocation calculation. Sometimes when there is no more space left in the System then we need to check in the existing databases and …

Continue reading

How To Use Built-in Functions in Teradata?

First of all what are Built-in functions? These are functions which do not need any sort of arguments but still returns information about the system; user, date, time, session etc. Built-in functions are sometimes referred to as special registers. Mostly used with the SELECT statement. SELECT <Built-In Function> • ACCOUNT: – If you are wondering …

Continue reading

LIKE with ESCAPE sequence

LIKE is used in Teradata to match string against a set of pattern which a user required. There are two wild card characters used in LIKE and they are – ‘_’ and ‘%’. ‘_’ is used for single character search. ‘%’ is used for multiple character search. For e.g. 1) Suppose we want to search …

Continue reading

How to get Case Sensitivity in Teradata

Teradata by default is case insensitive. Whatever value you compare in the WHERE clause it does not match the exact case of that value. So what if there is a scenario when you want to compare the value along with its specific case in the WHERE clause. Here come the CASESPECIFIC keyword for the rescue.Just …

Continue reading