Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 performance from a view

Author  Topic 

dmaxj
Posting Yak Master

174 Posts

Posted - 2014-02-06 : 10:30:33
I am trying to improve the performance of a table view... I tried creating statistics for the view, but I get an error message 'Cannot create statistics on view 'Appointments' because the view is not schema bound'

I have researched, but still do not have a definitive understanding of what the error means.

Overall, I am trying to get better performance from views that contain many joins on tables that exist in another database on the same SQL Server.

Regards

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-02-06 : 16:59:49
[code]CREATE VIEW dbo.Something
WITH SCHEMABINDING
AS

SELECT *
FROM dbo.Table
GO[/code]


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2014-02-08 : 02:13:12
This materialized view also allows you to create a clustered index - which may improve response time

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-02-08 : 11:22:24
Technically, a schemabound view is not materialized.
It becomes materialized when the clustered index is built on top of it.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

dmaxj
Posting Yak Master

174 Posts

Posted - 2014-02-08 : 14:43:58
Thanks,everyone... I guess this has turned into another issue now because I get the following error:

Cannot schema bind view <viewName> because name <linkedServeTableName> is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.

Does this mean that I am out of luck since the view includes a linked server?

Regards
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2014-02-10 : 01:51:08
@swepeso -yes , I should have said "make view schemabound and add a clustered index - it then becomes a materialized view" .

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -