Search code examples
sql-serversql-server-2016sql-server-2019

SQL Server having OLEDB waits on local view


I have some SQL Server views compiled as follows, some of them brings a large amount of data and causes OLEDB wait type, like if this it's being accessed from another instance.

CREATE VIEW [schema].[view_name] 
AS
    SELECT (...) 
    FROM [instance].[database].[schema].table

Is this a instance's parameter I can set to work without running the VIEW like it was a linked server? We're currently working on SQL Server 2016 and 2019, both return the same results.

Thanks!


Solution

  • I use 4-part names in my views SQL Server will treat it as a linked server?

    Yes. And that's a bad thing. So don't do that. Always use 3-part names to refer to objects other databases in the same instance, and 2-part names to refer to objects in the same database.