![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Fri, 18 Jan 2002 @ 21:31:21 GMT
Subj: | | Re: Optimize Spool Space via View Creation? |
|
From: | | Todd A. Walter |
The Teradata optimizer always takes care of that for you. Columns not required by the query will not be copied into spool files.
Unneeded columns will always be removed as early in the plan as possible. For instance a column might be required to evaluate a where
condition early in the plan so it is copied into the early spool file(s). However, if the column does not participate in the rest of the
query or in the query result, it will not be copied into subsequent spools as joins, aggregates,... are performed.
There is one "except" to this. If users or tools are in the habit of using "SELECT *" rather than being specific about the desired query
results, then a view which subsets the columns to only those required by the user will result in smaller spool and result files (and of
course a different result column list). The optimizer must of course carry all columns along in all intermediate results if all columns are
requested in the query result.
| |