All Forums Database
09 Jul 2013
Problem While Joining Views: Intermediate spool being used in stead of View result

I am getting spool space error while trying to join 3-5 views that are accessing same underlying tables.
Teradata optimizer is using the intermediate spool result in stead of the actual view output while joining. As a result, it is using much more data which would otherwise be filtered out in the join conditions inside view definiton.
Example: select * from view1 inner join view2 on (<join condition>) inner join view3 on (<join condition3>)
All 3 views access same tables table1 and table2  but with different filter conditions. While joining view1, view2 and view3, in stead of joining three different filtered recordsets from table1 and table2, it is joining table1, table2 thrice and then applying the filters. As these two tables contain huge records, multiple copies of redundant data is being created in spool and the spool space error is thrown.
Can any one suggest how to avoid this situation?

dnoeth 4628 posts Joined 11/04
09 Jul 2013

Hi Sayantan
the optimizer sems to think this is the best option.
Could you show the query plus explain? Statistics?


You must sign in to leave a comment.