|
|
Archives of the TeradataForum
Message Posted: Tue, 25 Dec 2002 @ 04:19:08 GMT
Subj: | | Re: Unnecessary spool step |
|
From: | | Walter, Todd A |
In most complex queries, you will see a last step which appears to simply re-spool the result spool file. It is not really re-spooling
it, rather it is reformatting the data to prepare it for return to the requesting application. This is required because all of the internal
processing steps (joins, scans, aggregates,...) all work on data in the Teradata internal formats while your application wants the data in
the client data type formats (appropriate character sets, formatting applied, right floating point representation, big/little endian,...).
For aggregate results, the grouping key also needs to be stripped out. In this particular plan it is a little more confusing since the
result comes from a UNION operation. Step 3.1 formats the result of the first SELECT (spool 2) into client format.
Step 4 does the same for the result of the second SELECT (spool 4) after applying the HAVING clause and the ORDER BY. Note that Step 3.1
and step 4 both write their results into spool 1 which is the final result spool all formatted and ready to be returned to the client
application.
| |