GetItemByID在非特权用户的大名单上非常慢,在Sharepoint 2010中快速用于站点管理员

时间:2013-10-28 09:11:49

标签: sharepoint sharepoint-2010

我有大型列表(大约20 000个项目)和标准的Sharepoint 2010显示形式,它在内部调用方法SPList.GetItemById(id)。此方法执行sql查询以通过内容数据库中的id获取项目。

问题是对于非特权用户,然后对于站点管理员,方法SPList.GetItemById(id)执行10-20倍。因此,为非特权用户打开显示表单需要10秒,对于站点管理员则需要不到1秒。

我在探查器的帮助下发现,瓶颈在SQL查询中,Sharepoint 2010为非特权用户构建。

对于非特权用户和站点管理员,SQL查询是不同的。

您能否建议解决方案或解决方法以提高非特权用户的性能?

我使用标准的Sharepoint 2010显示表单,因此我无法用其他更快速的方法替换SPList.GetItemById(id)方法。

可能会有所帮助:非特权用户的SQL查询有一些额外的连接,包括网站管理员:

INNER JOIN (SELECT CAST(val AS uniqueidentifier) AS InValues
FROM dbo.fn_UnpackCsvString(@L3TXP) ) AS Scopes ON (t1.ScopeId = Scopes.InValues)

LEFT OUTER JOIN (SELECT * FROM AllUserData AS t32_u 
WITH(NOLOCK,INDEX=AllUserData_PK) INNER JOIN Docs AS t32_d 
WITH(NOLOCK) ON (t32_d.DoclibRowId =t32_u.tp_ID  AND
t32_u.[tp_CalculatedVersion] = 0  AND
t32_u.[tp_DeleteTransactionId] = 0x  AND
t32_u.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND
(t32_d.SiteId=t32_u.tp_SiteId) AND
(t32_d.SiteId = @SITEID) AND
(t32_d.ParentId = t32_u.tp_ParentId) AND
(t32_d.Id = t32_u.tp_DocId) AND
( (t32_u.tp_Level = 1) ) AND
(t32_d.Level = t32_u.tp_Level) AND
(t32_d.IsCurrentVersion = 1) AND
(t32_d.Level = 1 OR t32_d.Level =  2) 
INNER JOIN (SELECT CAST(val AS uniqueidentifier) AS InValues 
FROM dbo.fn_UnpackCsvString(@L3TXP) ) AS Scopes ON
(t32_d.ScopeId = Scopes.InValues)) AS t32 ON
(t32.[tp_ListId] = @L2) AND

表Docs AS t1

1 个答案:

答案 0 :(得分:0)

需要提及的是列表中的每个项目都有自己的一组权限。

所以它看起来像SharePoint performance degradation with a large number of unique security scopes in lists