Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

How Is It That Views Can Be Indexed?

$
0
0
I'm told a view doesn't take up space in a DB. In that case, it's just a query (compiled SQL), right?

And if it's just a query, how can it be indexed?
And if it's just a query, how can it have a clustered index? What would be the difference - if it's just a query - between a clustered index and a nonclustered index?

If I give it a clustered index, will this index be fragmented over time and thus need to be rebuilt/reorgnized?
If I give it a nonclustered index, will this index be fragmented over time and thus need to be rebuilt/reorgnized?

Would I likely get nearly-as-good performance by going with a  CTE instead of a view?


I suppose someone will say, "Just try it and see how it works". Easier said than done, because I have multiple SPs that I will have to rewrite to run these tests, so I'm hoping to save some time by getting some solid recommendations on this thread.

Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>