How it works...

As the same column, q_amount appears in both states, the optimizer will use a multi-column stats spool to derive stats for the single one. This is done on a single scan, hence reducing the spool and resources.

In earlier versions, Teradata collected stats on a table by reading the full table; from version 14.00, it will check for all possible indexes, join indexes, and hash indexes for column access.

Suppose that a table has more than 10 columns and it has a join index present with three columns. Collecting stats on a column which is present in both a table and NON sparse join index, Teradata might choose to access the column through the join index, because the row size in the join index will be smaller than the table, and ...

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.