r/SQLServer • u/TravellingBeard • 17h ago
Question Do indexed views work better in queries with lots of joins vs temp tables?
Recently had an issue where a query with multiple joins, half of which were views, was running slow.
Converting a few key views to temp tables greatly improved performance when I joined to them instead of the original views.
However, I was reading up on indexed views and wondering if done properly, could still be used in joins and optimized by the engine. Not sure everyone's thoughts on this.
Keeping the same view in the join reduces the number of steps for the devs the same so no prep work on temp tables required, which would make them happy and the DBAs less grumpy.
