|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating Indexes on ViewsHi,
I have a view which uses 2 other views.I need to create an index on this view. But one of the two other views has Union statements. Is there any way that an index can be created on this final view ( which is made of the other 2 views)? Thanks -- pmud Indexed views cannot reference other views, and a view definition cannot
include a UNION. More here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_06_9jnb.asp ML --- http://milambda.blogspot.com/ Yes, I read that article, but i thought maybe someone ahs faced the same
problem as me and has a workaround for this. :( -- Show quotepmud "ML" wrote: > Indexed views cannot reference other views, and a view definition cannot > include a UNION. More here: > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_06_9jnb.asp > > > ML > > --- > http://milambda.blogspot.com/ I was once in a similar situation, but found out that I could avoid it by
slightly adapting the data model. Maybe there's something else that would help you achieve your goal, but you'd have to post DDL (and maybe some sample data). ML --- http://milambda.blogspot.com/ I don't know your real problem (because you haven't told it), or your
experience with SQL Server. It sounds like you are asking for a kludge. The first step would be to add index(es) to the base table(s). In many cases this will increase performance sufficiently, and other queries (queries that do not use your view) will also benefit from these indexes. If this is not enough, you can consider indexing the view. But as you have noticed there are many limitations to that, and you need Enterprise Edition (or always use the appropriate view hints). Gert-Jan pmud wrote: Show quote > > Hi, > > I have a view which uses 2 other views.I need to create an index on this > view. But one of the two other views has Union statements. Is there any way > that an index can be created on this final view ( which is made of the other > 2 views)? > > Thanks > > -- > pmud |
|||||||||||||||||||||||