为什么 DNN 连续运行此查询:
Select count(*)
from dbo.DNN_vw_users
where portalID = @PortalID and IsDeleted = 0
此查询占用的总 CPU 时间超过 600,000 毫秒,并且还在增加。
USE [gssdb]
去
ALTER VIEW [dbo].[DNN_vw_Users]
AS
SELECT
U.UserID,
UP.PortalId,
U.Username,
U.FirstName,
U.LastName,
U.DisplayName,
U.IsSuperUser,
U.Email,
U.AffiliateId,
U.UpdatePassword,
UP.Authorised,
(CASE WHEN UP.PortalId IS NULL THEN U.IsDeleted ELSE UP.IsDeleted END) AS IsDeleted,
UP.RefreshRoles,
U.LastIPAddress,
U.CreatedByUserID,
U.CreatedOnDate,
U.LastModifiedByUserID,
U.LastModifiedOnDate
FROM dbo.DNN_Users AS U
LEFT OUTER JOIN dbo.DNN_UserPortals AS UP ON U.UserID = UP.UserId