Cynthia Hill
asked on
Using a View vs.a Temp Table in a Stored Procedure
Hello - Wanted to get some guidance regarding best practices on when to use a View vs a Temp Table in Stored Procedures.
Is there any downfall to using a View for a stored Procedure over using a Temp Table?
The database I am working in is a datawarehouse that is updated once a month. I tend to lean towards using a View because I can always look back on the results in the view if I have questions during that month on how a particlar field was dervied during load.
All that said, I wanted to see id anyone had information on this topic to share? Is a Temp Table better, if so...why? Is it simply a matter of personal preference?
Thanks in advance for yoru time.
Is there any downfall to using a View for a stored Procedure over using a Temp Table?
The database I am working in is a datawarehouse that is updated once a month. I tend to lean towards using a View because I can always look back on the results in the view if I have questions during that month on how a particlar field was dervied during load.
All that said, I wanted to see id anyone had information on this topic to share? Is a Temp Table better, if so...why? Is it simply a matter of personal preference?
Thanks in advance for yoru time.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If your view aggregates data it wound be faster to write that as a physical table. My current employer's data warehouse has all kinds of tables for by month, by quarter, by year, by custom time span, individual client, all clients, you get the idea.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks All!