question

cstephen avatar image
cstephen asked

Is it possible to create index in views

In my production Server.We are spooling records normally in Views in many of our reports related stored procedures..so My question is (whether we can create clustered or nonclustered index for an table views (for ex:i am having customer table ci_doc_hdr..some purpose i have created view on same table ci_do_hdr_vw..i will use this view whenever possible in my stored procedure.so shall i create index for this views..for tuning purpose..since it is taking so much time...while launching report screeen...
performance-tuning
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

eghetto avatar image
eghetto answered
[Designing Indexed Views (MSDN)][1] [1]: http://msdn.microsoft.com/en-us/library/ms187864(v=sql.105).aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JohnM avatar image
JohnM answered
The short answer is 'Yes' as pointed out by @eghetto. However, before going straight to using indexed views, have you looked at where the performance issue might be occurring? Statistics out of date? Fragmented Indexes? WaitStats? Indexed views certainly have their place in the world however going straight to them without looking at what the underlying issue might be isn't the way that I would go. Just my opinion though. ;-)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.