Link to home
Start Free TrialLog in
Avatar of Cynthia Hill
Cynthia HillFlag for United States of America

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.
SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cynthia Hill

ASKER

Thanks All!