Archives of the TeradataForum
Message Posted: Thu, 10 Jun 2004 @ 16:17:53 GMT
Without changing the underlying tables, I would suggest trying some pre-aggregation via derived tables.
On the DAILY_SPEND side, you could aggregate the sum amounts to the highest level possible while preseving the group by information. This may not be possible, but it's something to consider.
On the DATE side, you can aggregate on the BCWEEKID such that you only have one row per BCWEEKID with a min date representing the beginning of the week and a max date representing the end of the week. You could then change the equality compare in the where clause to a BETWEEN. Even if there is no pre-aggregation benefit from DAILY_SPEND, this strategy should reduce the number of row compares from the product join by 7:1.
Of course, I am making a lot of assumptions about the data and the table structure, but I've had success with this type of strategy in the past insimilar situations.
Hope you find this helpful.
Thomas F. Stanek
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|