Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Teradata Cookbook

You're reading from   Teradata Cookbook Over 85 recipes to implement efficient data warehousing solutions

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher Packt
ISBN-13 9781787280786
Length 454 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Abhinav Khandelwal Abhinav Khandelwal
Author Profile Icon Abhinav Khandelwal
Abhinav Khandelwal
Viswanath Kasi Viswanath Kasi
Author Profile Icon Viswanath Kasi
Viswanath Kasi
Rajsekhar Bhamidipati Rajsekhar Bhamidipati
Author Profile Icon Rajsekhar Bhamidipati
Rajsekhar Bhamidipati
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Installation 2. SQLs FREE CHAPTER 3. Advanced SQL with Backup and Restore 4. All about Indexes 5. Mixing Strategies – Joining of Tables 6. Building Loading Utility – Replication and Loading 7. Monitoring the better way 8. Collect Statistics the Better Way 9. Application and OPS DBA Insight 10. DBA Insight 11. Performance Tuning 12. Troubleshooting 13. Other Books You May Enjoy

Eliminating product joins

Product joins, cross joins, or Cartesian joins, are mainly created unintentionally. These are the most expensive types of joins when you are joining two tables with millions of rows. 

In the cross join, every column in the left table is joined to every column in the right table! So, if you have a one billion row table and cross join it to a 100 row table, your answer set will have 100 billion rows!

These joins happen when you:

  • Mention CROSS join explicitly
  • Missed a join condition in a query as shown in following code
  • Wrongly used aliases in a query
/*Missed join PRODUCT JOIN*/
SELECT
COUNTRY_ID,
REVI_ID,
AUCT_CODE,
FROM
COUNTRIES, -- NO JOIN SPECIFIED
AUCT_TYPES

And when you check the EXPLAIN plan for the query, you will get the product join in it:

/*EXPLAIN PLAN SHOWING PRODUCT JOIN*/
4) We do an all-AMPs JOIN step from Spool 2 (Last Use) by way...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image