相关疑难解决方法(0)

我应该对这个 NO JOIN PREDICATE 警告感到震惊吗?

我正在对性能不佳的存储过程的点点滴滴进行故障排除。程序的这一部分抛出了一个 NO JOIN PREDICATE 警告

select
    method = 
        case methoddescription 
            when 'blah' then 'Ethylene Oxide'
            when NULL then 'N/A'
            else methoddescription
        end,
    testmethod = 
        case methoddescription 
            when 'blah' then 'Biological Indicators'
            when NULL then 'N/A'
            else 'Dosimeter Reports'
        end,
    result = 
        case when l.res is null or l.res <> 1 then 'Failed'
        else 'Passed'
        end,
    datecomplete = COALESCE(CONVERT(varchar(10), NULL, 101),'N/A')
from db2.dbo.view ls
    join db1.dbo.table l
        on ls.id = l.id
    where item = '19003'
        and l.id = '732820'
Run Code Online (Sandbox Code Playgroud)

视图 ( …

sql-server execution-plan sql-server-2008-r2 warning

21
推荐指数
1
解决办法
5144
查看次数

帮助查找没有谓词的连接

很像swasheck 的一个相关问题,我有一个历史上曾遭受性能问题的查询。我正在查看 SSMS 上的查询计划并注意到Nested Loops (Inner Join)警告:

无连接谓词

根据一些仓促的研究(鼓舞人心的DBABrent Ozar 的信心),看起来这个警告告诉我我的查询中有一个隐藏的笛卡尔积。我已经检查了几次我的查询,但没有看到交叉连接。这是查询:

DECLARE @UserId INT; -- Stored procedure input
DECLARE @Now DATETIME2(7) = SYSUTCDATETIME();
;WITH AggregateStepData_CTE AS -- Considering converting this CTE into an indexed view
(
    SELECT 
        [UA].[UserId] -- FK to the UserId
        , [UA].[DeviceId] -- FK to the push device's DeviceId (int)
        , SUM(ISNULL([UA].[LatestSteps], 0)) AS [Steps]
    FROM [User].[UserStatus] [UA]
        INNER JOIN [User].[CurrentConnections] [M] ON 
           [M].[Monitored] = [UA].[UserId] AND …
Run Code Online (Sandbox Code Playgroud)

performance join sql-server azure-sql-database query-performance

7
推荐指数
1
解决办法
532
查看次数