Book Image

Teradata Cookbook

By : Abhinav Khandelwal, Viswanath Kasi, Rajsekhar Bhamidipati
Book Image

Teradata Cookbook

By: Abhinav Khandelwal, Viswanath Kasi, Rajsekhar Bhamidipati

Overview of this book

Teradata is an enterprise software company that develops and sells its eponymous relational database management system (RDBMS), which is considered to be a leading data warehousing solutions and provides data management solutions for analytics. This book will help you get all the practical information you need for the creation and implementation of your data warehousing solution using Teradata. The book begins with recipes on quickly setting up a development environment so you can work with different types of data structuring and manipulation function. You will tackle all problems related to efficient querying, stored procedure searching, and navigation techniques. Additionally, you’ll master various administrative tasks such as user and security management, workload management, high availability, performance tuning, and monitoring. This book is designed to take you through the best practices of performing the real daily tasks of a Teradata DBA, and will help you tackle any problem you might encounter in the process.
Table of Contents (19 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Improving delete performance


Delete is a data manipulation language, or DML operator for removing one or more rows from a table. You can also delete a user or a database:

DELETE FROM table_name [ALL | WHERE condition];

Getting ready

For this recipe to complete you need to connect to the Teradata instance and open SQLA.

How to do it...

  1. Identify the table from which data needs to be deleted.
  2. Delete full tables or only required rows:
DELETE FROM test01.web_clicks ALL; -- All rows deleted
DELETE FROM test01.web_clicks where site=01 and partition_date=date-1 -- Rows with Site=0 only deletes and use partition column to avoid full table scan.

How it works...

There are a few basic considerations that need to be taken into account while writing a delete query; access to the data needs to be optimized, which means the access path the optimizer chooses should be efficient:

  • Full table scan: Use primary index column, PPI, if available, when doing a delete of a million rows.
  • Index access: Use index, if available...