Archives of the TeradataForum
Message Posted: Tue, 06 Apr 2004 @ 17:59:00 GMT
| Subj: || || Aggregating a derived table |
| From: || || rablum |
I have a query that attempts to aggregate fields from a derived table. The derived table runs in 5 minutes, with approx 100,000 records, but
the aggregation runs out of spool space. I need tocount/sum a distinct set of records, hence the derived table.
How can I improve the query so it doesn't run out of spool space?
It looks something like this:
select count (t1.col1), sum (t1.col2), t1.col3
(Select Distinct col1, col2, col3, col4, col5
from table1) t1
Group by t1.col3