none
DataFormWebPart SingleDataSource ,如何设置DataSourceSelectArguments.RetrieveTotalRowCount 为 false RRS feed

  • 问题

  •  

    有一个SharePoint 2010 xsltlistviewwebpart , 展现比较慢(当然,也比较大,三万多文档,200多目录,还有不少地方权限打断继承)。我从Developer Dashboard 里面看如下信息:



    Monitoring Tag(nasq) Entering monitored scope (DataBinding DataFormWebPart (专业文档)) 0.613753214444853 0.011011
    Document Management Tag(52of) MetadataNavigationContext XsltListViewWebPart_DataBinding: XsltListViewWebPart[ctl00$m$g_ce9bf7a3_ee86_4d69_9a36_9092d1db2151] found ListViewDataSource[ctl00$m$g_ce9bf7a3_ee86_4d69_9a36_9092d1db2151$ctl00] setting Scope[Recursive] and key filters from[ctl00$ctl48$ListViewKeyFilters] for list view context folder[/dc/kms/ProjectDoc] 0.61426983038347 0.000517
    Document Management Tag(52og) MetadataNavigationContext ListViewDataSource_Selecting: SPDataSource[[ctl00$m$g_ce9bf7a3_ee86_4d69_9a36_9092d1db2151$ctl00]] is ready to query data with the following CAML: [<View><ViewFields><FieldRef Name="ID"/><FieldRef Name="PermMask"/><FieldRef Name="HTML_x0020_File_x0020_Type"/><FieldRef Name="File_x0020_Type"/><FieldRef Name="FSObjType"/><FieldRef Name="FileRef"/><FieldRef Name="FileLeafRef"/><FieldRef Name="CheckoutUser"/><FieldRef Name="CheckedOutUserId"/><FieldRef Name="IsCheckedoutToLocal"/><FieldRef Name="Created_x0020_Date"/><FieldRef Name="ContentTypeId"/><FieldRef Name="CompanyMetaData"/><FieldRef Name="ProjectMetaData"/><FieldRef Name="StepMetaData"/><FieldRef Name="SpecialityMetaData"/><FieldRef Name="ApplyPerson" AutoHyperLink="TRUE"/><FieldRef Name="ApplyDateTime"/><FieldRef Name="BpmNo" AutoHyperLink="TRUE"/><FieldRef Name="BrowseCount"/><FieldRef Name="Created"/></ViewFields><Query><OrderBy><FieldRef Name="Created" Ascending="FALSE" /><FieldRef Name="FileLeafRef" /></OrderBy></Query></View>] 0.614750059015881 0.000480
    Monitoring Tag(nasq) Entering monitored scope (Parse CAML XML) 0.614843087599122 0.000093
    Monitoring Tag(b4ly) Leaving Monitored Scope (Parse CAML XML). 执行时间=0.176558752578889 0.615140820970263 0.000298
    Monitoring Tag(nass) ____CAML and Overridden Clauses=<View><ViewFields><FieldRef Name="ID"/><FieldRef Name="PermMask"/><FieldRef Name="HTML_x0020_File_x0020_Type"/><FieldRef Name="File_x0020_Type"/><FieldRef Name="FSObjType"/><FieldRef Name="FileRef"/><FieldRef Name="FileLeafRef"/><FieldRef Name="CheckoutUser"/><FieldRef Name="CheckedOutUserId"/><FieldRef Name="IsCheckedoutToLocal"/><FieldRef Name="Created_x0020_Date"/><FieldRef Name="ContentTypeId"/><FieldRef Name="CompanyMetaData"/><FieldRef Name="ProjectMetaData"/><FieldRef Name="StepMetaData"/><FieldRef Name="SpecialityMetaData"/><FieldRef Name="ApplyPerson" AutoHyperLink="TRUE"/><FieldRef Name="ApplyDateTime"/><FieldRef Name="BpmNo" AutoHyperLink="TRUE"/><FieldRef Name="BrowseCount"/><FieldRef Name="Created"/></ViewFields><Query><OrderBy><FieldRef Name="Created" Ascending="FALSE" /><FieldRef Name="FileLeafRef" /></OrderBy></Query></View> Parsed clauses:  OverrideClauses: 0.615237411458719 0.000097
    Monitoring Tag(nass) ____执行时间=0.176558752578889 0.61532073210422 0.000083
    General Tag(g3ql) GetUriScheme(/dc/kms/ProjectDoc) 0.616205551264197 0.000885
    Monitoring Tag(nasq) Entering monitored scope (EnsureListItemsData) 0.616345932234404 0.000140
    Database Tag(tkeb) Setting database session for {1e1d14d6-88bb-46c6-b235-925ed1a54d8f}. 0.621210447137835 0.004865
    Database Tag(tkqc) SqlCommand StackTrace-Native: stswel.dll: (unresolved symbol, module offset=000000000015A1AE) at 0x000007FEF029A1AE
    stswel.dll: (unresolved symbol, module offset=000000000015A31B) at 0x000007FEF029A31B
    stswel.dll: (unresolved symbol, module offset=000000000016D52A) at 0x000007FEF02AD52A
    owssvr.dll: (unresolved symbol, module offset=0000000000153112) at 0x000007FEEA8E3112
    owssvr.dll: (unresolved symbol, module offset=00000000001538EA) at 0x000007FEEA8E38EA
    owssvr.dll: (unresolved symbol, module offset=000000000006EC4F) at 0x000007FEEA7FEC4F
    owssvr.dll: (unresolved symbol, module offset=000000000010ECE5) at 0x000007FEEA89ECE5
    owssvr.dll: (unresolved symbol, module offset=0000000000102D50) at 0x000007FEEA892D50
    owssvr.dll: (unresolved symbol, module offset=000000000018F3E0) at 0x000007FEEA91F3E0
    owssvr.dll: (unresolved symbol, module offset=000000000019B05C) at 0x000007FEEA92B05C
    owssvr.dll: (unresolved symbol, module offset=00000000001932DD) at 0x000007FEEA9232DD
    owssvr.dll: (unresolved symbol, module offset=000000000019920E) at 0x000007FEEA92920E
    owssvr.dll: (unresolved symbol, module offset=000000000000D059) at 0x000007FEEA79D059
    owssvr.dll: (unresolved symbol, module offset=0000000000027E29) at 0x000007FEEA7B7E29
    mscorwks.dll: (unresolved symbol, module offset=00000000002BCD67) at 0x000007FEF398CD67
    Microsoft.SharePoint.Library.ni.dll: (unresolved symbol, module offset=000000000010EE09) at 0x000007FEE984EE09
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001AC9D50) at 0x000007FEED6B9D50
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001C002C5) at 0x000007FEED7F02C5
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001BFE07A) at 0x000007FEED7EE07A
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=00000000021B95BC) at 0x000007FEEDDA95BC
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=000000000214A6B2) at 0x000007FEEDD3A6B2
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=000000000214A36B) at 0x000007FEEDD3A36B
    Microsoft.SharePoint.ni.dl
    0.622616910808497 0.001406
    Database Tag(b6p4) SqlCommand: ; EXEC proc_getlistmetadataandeventreceivers '5f781af7-ecac-4610-9455-d31197daeb1a', 'af661fd8-3d5f-4d5e-9de8-fbc1678176fe', 'b4049485-6a59-478d-a819-82eb99f1252f', 1, 200000, 0, 1, 1073741823, @currentfolderurl, @RequestGuid OUTPUT 0.622818263215018 0.000201
    Database Tag(tzku) ConnectionString: 'Data Source=mosssql;Initial Catalog=WSS_Content_Dcs_Kms;Integrated Security=True;Enlist=False;Asynchronous Processing=False;Connect Timeout=15'
     ConnectionState: Closed ConnectionTimeout: 15
    0.623012002922159 0.000194
    Database Tag(8acb) Reverting to process identity 0.623091621979889 0.000080
    Database Tag(8acc) Current user before SqlConnection.Open: Name: EXCEGROUP\mossadmin SID: S-1-5-21-140102601-2160117936-2553866927-15449 ImpersonationLevel: None 0.624308955467804 0.001217
    Database Tag(8acf) Current user after SqlConnection.Open: Name: EXCEGROUP\mossadmin SID: S-1-5-21-140102601-2160117936-2553866927-15449 ImpersonationLevel: None 0.625082098423124 0.000773
    Database Tag(tzkv) SqlCommand: 'proc_GetListMetaDataAndEventReceivers'
      CommandType: StoredProcedure CommandTimeout: 0
      Parameter: '@RETURN_VALUE' Type: Int Size: 0 Direction: ReturnValue Value: ''
      Parameter: '@SiteId' Type: UniqueIdentifier Size: 0 Direction: Input Value: '5f781af7-ecac-4610-9455-d31197daeb1a'
      Parameter: '@WebId' Type: UniqueIdentifier Size: 0 Direction: Input Value: 'af661fd8-3d5f-4d5e-9de8-fbc1678176fe'
      Parameter: '@ListId' Type: UniqueIdentifier Size: 0 Direction: Input Value: 'b4049485-6a59-478d-a819-82eb99f1252f'
      Parameter: '@PrefetchListScope' Type: Bit Size: 0 Direction: Input Value: 'True'
      Parameter: '@ThresholdScopeCount' Type: Int Size: 0 Direction: Input Value: '200000'
      Parameter: '@PrefetchRelatedFields' Type: Bit Size: 0 Direction: Input Value: 'False'
      Parameter: '@PrefetchWebParts' Type: Bit Size: 0 Direction: Input Value: 'True'
      Parameter: '@UserId' Type: Int Size: 0 Direction: Input Value: '1073741823'
      Parameter: '@CurrentFolderUrl' Type: NVarChar Size: 4000 Direction: Input Value: 'dc/kms/ProjectDoc'
      Parameter: '@RequestGuid' Type: UniqueIdentifier Size: 0 Direction: Input Value: '042893cf-f9b6-4b97-8a7b-8ef008d7ead9'
    0.627372543158418 0.002290
    Database Tag(tzkk) SqlCommand StackTrace-Managed:    在 Microsoft.SharePoint.Utilities.SqlSession.OnPreExecuteCommand(SqlCommand command)
      在 Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)
      在 Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)
      在 Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)
      在 Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
      在 Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
      在 Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()
      在 Microsoft.SharePoint.SPListItemCollection.get_Count()
      在 Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)
      在 Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()
      在 Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformSelect()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.DataBind()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.EnsureDataBound()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()
      在 Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.CreateChildControls()
      在 Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()
      在 System.Web.UI.Control.EnsureChildControls()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      在 System.Web.UI.Page.ProcessRequest()
      在 System.Web.UI.Page.ProcessRequest(HttpContext context)
      在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
      在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
      在 System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
      在 System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
      在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    0.628461857582458 0.001089
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'AllWebs'。扫描计数 0,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.632100099314298 0.003638
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetFolderInfo, 表 'AllDocs'。扫描计数 1,逻辑读取 6 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.63223209933106 0.000132
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'Worktable'。扫描计数 0,逻辑读取 0 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.633316385183033 0.001084
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'AllDocs'。扫描计数 0,逻辑读取 6 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.633435394721955 0.000119
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'Perms'。扫描计数 0,逻辑读取 6 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.633527026479622 0.000092
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'AllListsAux'。扫描计数 0,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.63363164871513 0.000105
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListMetaData, 表 'AllLists'。扫描计数 0,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 3 次,lob 物理读取 0 次,lob 预读 0 次。 0.633734594759949 0.000103
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetUniqueScopesInList, 表 'AllLists'。扫描计数 0,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.633824969374599 0.000090
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetEventReceivers, 表 'AllSites'。扫描计数 0,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.633948658279195 0.000124
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetEventReceivers, 表 'EventReceivers'。扫描计数 1,逻辑读取 2 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.634125566238167 0.000177
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListWebParts, 表 'Worktable'。扫描计数 0,逻辑读取 0 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.634364004363683 0.000238
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListWebParts, 表 'AllDocs'。扫描计数 0,逻辑读取 24 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 0.634475191679389 0.000111
    Database Tag(fdz2) SQL IO Statistics: Procedure proc_GetListWebParts, 表 'AllWebParts'。扫描计数 1,逻辑读取 10 次,物理读取 0 次,预读 0 次,lob 逻辑读取 2 次,lob 物理读取 0 次,lob 预读 0 次。 0.634592385345065 0.000117
    SQM Tag(97qu) SQM: Datapoint id 8848 marked as Increment datapoint. 0.635372652110813 0.000780
    Database Tag(tkeb) Setting database session for {1e1d14d6-88bb-46c6-b235-925ed1a54d8f}. 0.636556182419833 0.001184
    Database Tag(tkqc) SqlCommand StackTrace-Native: stswel.dll: (unresolved symbol, module offset=000000000015A1AE) at 0x000007FEF029A1AE
    stswel.dll: (unresolved symbol, module offset=000000000015A31B) at 0x000007FEF029A31B
    owssvr.dll: (unresolved symbol, module offset=000000000032B60C) at 0x000007FEEAABB60C
    owssvr.dll: (unresolved symbol, module offset=000000000021B656) at 0x000007FEEA9AB656
    owssvr.dll: (unresolved symbol, module offset=0000000000227E63) at 0x000007FEEA9B7E63
    owssvr.dll: (unresolved symbol, module offset=0000000000229784) at 0x000007FEEA9B9784
    owssvr.dll: (unresolved symbol, module offset=000000000018F61C) at 0x000007FEEA91F61C
    owssvr.dll: (unresolved symbol, module offset=000000000019B0CA) at 0x000007FEEA92B0CA
    owssvr.dll: (unresolved symbol, module offset=00000000001932DD) at 0x000007FEEA9232DD
    owssvr.dll: (unresolved symbol, module offset=000000000019920E) at 0x000007FEEA92920E
    owssvr.dll: (unresolved symbol, module offset=000000000000D059) at 0x000007FEEA79D059
    owssvr.dll: (unresolved symbol, module offset=0000000000027E29) at 0x000007FEEA7B7E29
    mscorwks.dll: (unresolved symbol, module offset=00000000002BCD67) at 0x000007FEF398CD67
    Microsoft.SharePoint.Library.ni.dll: (unresolved symbol, module offset=000000000010EE09) at 0x000007FEE984EE09
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001AC9D50) at 0x000007FEED6B9D50
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001C002C5) at 0x000007FEED7F02C5
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001BFE07A) at 0x000007FEED7EE07A
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=00000000021B95BC) at 0x000007FEEDDA95BC
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=000000000214A6B2) at 0x000007FEEDD3A6B2
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=000000000214A36B) at 0x000007FEEDD3A36B
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001F27635) at 0x000007FEEDB17635
    Microsoft.SharePoint.ni.dll: (unresolved symbol, module offset=0000000001F26418) at 0x000007FEE
    0.637905166718116 0.001349
    Database Tag(b6p4) SqlCommand: ;       select top(31) t1.[leafname] as c0, t2.[nvarchar4] as c6c9, userdata.[tp_contenttypeid], userdata.[datetime1], userdata.[nvarchar15], t1.[scopeid] as c4, userdata.[nvarchar4], userdata.[tp_checkoutuserid], t2.[tp_id] as c6c8, t3.[nvarchar10] as c14c15, userdata.[int3], userdata.[tp_moderationstatus], userdata.[tp_level], userdata.[int5], userdata.[nvarchar12], userdata.[tp_created], case when datalength(t1.dirname) = 0 then t1.leafname when datalength(t1.leafname) = 0 then t1.dirname else t1.dirname + N'/' + t1.leafname end  as c3, t1.[type] as c5, t2.[nvarchar1] as c6c7, t2.[tp_created] as c6c11, userdata.[int1], t4.[nvarchar10] as c16c15, t5.[nvarchar10] as c17c15, userdata.[tp_modified], t1.[sortbehavior] as c2, userdata.[nvarchar3], t2.[nvarchar6] as c6c10, userdata.[float1], userdata.[tp_id], t1.[ischeckouttolocal] as c13, t1.[timecreated] as c1, t1.[ltcheckoutuserid] as c12, userdata.[int4], t6.[nvarchar10] as c18c15 from alluserdata as userdata with(index=alluserdata_pk) inner join docs as t1 with(nolock) on (userdata.[tp_rowordinal] = 0) and (t1.siteid=userdata.tp_siteid) and (t1.siteid = '5f781af7-ecac-4610-9455-d31197daeb1a') and (t1.parentid = userdata.tp_parentid) and (t1.id = userdata.tp_docid) and ( (userdata.tp_level = 1 or  userdata.tp_level =255) ) and (t1.level = userdata.tp_level) and ((userdata.tp_level = 255 and t1.ltcheckoutuserid =1073741823 or (userdata.tp_level = 1 and (userdata.tp_draftownerid is null) or userdata.tp_level = 2)and (t1.ltcheckoutuserid is null or t1.ltcheckoutuserid <> 1073741823 ))) and (userdata.[tp_listid] ='ecc5afeb-d187-4ee8-a944-522ad7ee2e70') and (userdata.[tp_calculatedversion] = 0 ) and (userdata.[tp_iscurrentversion] = convert(bit,1) ) and (userdata.[tp_deletetransactionid] = 0x ) left outer loop join alluserdata as t2 with(nolock,index=alluserdata_pk) on (userdata.[tp_checkoutuserid]=t2.[tp_id]) and (userdata.[tp_rowordinal] = 0) and (t2.[tp_rowordinal] = 0) and ( (t2.tp_level = 1) ) and (t2.[tp_iscurrentversion] = convert(bit,1) ) and (t2.[tp_calculatedversion] = 0 ) and (t2.[tp_deletetransactionid] = 0x ) and (t2.tp_listid = '3a177c8f-4a48-470e-be16-68eee47b5080') and (userdata.tp_listid = 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70') left outer loop join alluserdata as t3 with(nolock,index=alluserdata_pk) on (userdata.[int1]=t3.[tp_id]) and (userdata.[tp_rowordinal] = 0) and (t3.[tp_rowordinal] = 0) and ( (t3.tp_level = 1) ) and (t3.[tp_iscurrentversion] = convert(bit,1) ) and (t3.[tp_calculatedversion] = 0 ) and (t3.[tp_deletetransactionid] = 0x ) and (t3.tp_listid = 'b4049485-6a59-478d-a819-82eb99f1252f') and (userdata.tp_listid = 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70') left outer loop join alluserdata as t4 with(nolock,index=alluserdata_pk) on (userdata.[int3]=t4.[tp_id]) and (userdata.[tp_rowordinal] = 0) and (t4.[tp_rowordinal] = 0) and ( (t4.tp_level = 1) ) and (t4.[tp_iscurrentversion] = convert(bit,1) ) and (t4.[tp_calculatedversion] = 0 ) and (t4.[tp_deletetransactionid] = 0x ) and (t4.tp_listid = 'b4049485-6a59-478d-a819-82eb99f1252f') and (userdata.tp_listid = 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70') left outer loop join alluserdata as t5 with(nolock,index=alluserdata_pk) on (userdata.[int4]=t5.[tp_id]) and (userdata.[tp_rowordinal] = 0) and (t5.[tp_rowordinal] = 0) and ( (t5.tp_level = 1) ) and (t5.[tp_iscurrentversion] = convert(bit,1) ) and (t5.[tp_calculatedversion] = 0 ) and (t5.[tp_deletetransactionid] = 0x ) and (t5.tp_listid = 'b4049485-6a59-478d-a819-82eb99f1252f') and (userdata.tp_listid = 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70') left outer loop join alluserdata as t6 with(nolock,index=alluserdata_pk) on (userdata.[int5]=t6.[tp_id]) and (userdata.[tp_rowordinal] = 0) and (t6.[tp_rowordinal] = 0) and ( (t6.tp_level = 1) ) and (t6.[tp_iscurrentversion] = convert(bit,1) ) and (t6.[tp_calculatedversion] = 0 ) and (t6.[tp_deletetransactionid] = 0x ) and (t6.tp_listid = 'b4049485-6a59-478d-a819-82eb99f1252f') and (userdata.tp_listid = 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70') where (userdata.[tp_calculatedversion] = 0 ) and (userdata.[tp_iscurrentversion] = convert(bit,1) ) and (userdata.[tp_deletetransactionid] = 0x ) and (userdata.tp_listid='ecc5afeb-d187-4ee8-a944-522ad7ee2e70') and ( (userdata.tp_level = 1 or  userdata.tp_level =255)  and ( userdata.tp_level= 255 and userdata.tp_checkoutuserid = 1073741823 or  ( userdata.tp_level  = 2 and userdata.tp_draftownerid is not null or userdata.tp_level  = 1 and userdata.tp_draftownerid is  null  ) and ( userdata.tp_checkoutuserid is  null  or userdata.tp_checkoutuserid <> 1073741823))) and (userdata.tp_siteid='5f781af7-ecac-4610-9455-d31197daeb1a') and (userdata.tp_rowordinal=0) and (t1.siteid='5f781af7-ecac-4610-9455-d31197daeb1a' and (t1.dirname=@dn or t1.dirname like @dnel+N'/%') and t1.sortbehavior=0) order by userdata.[tp_created]  desc ,t1.[leafname] collate chinese_prc_ci_as  asc ,userdata.[tp_id]  asc  option (force order, maxdop 1) 0.638660569988644 0.000755
    Database Tag(tzku) ConnectionString: 'Data Source=mosssql;Initial Catalog=WSS_Content_Dcs_Kms;Integrated Security=True;Enlist=False;Asynchronous Processing=False;Connect Timeout=15'
     ConnectionState: Closed ConnectionTimeout: 15
    0.638825604930236 0.000165
    Database Tag(8acb) Reverting to process identity 0.638926804943086 0.000101
    Database Tag(8acc) Current user before SqlConnection.Open: Name: EXCEGROUP\mossadmin SID: S-1-5-21-140102601-2160117936-2553866927-15449 ImpersonationLevel: None 0.639789693941548 0.000863
    Database Tag(8acf) Current user after SqlConnection.Open: Name: EXCEGROUP\mossadmin SID: S-1-5-21-140102601-2160117936-2553866927-15449 ImpersonationLevel: None 0.640537624195254 0.000748
    Database Tag(tzkv) SqlCommand: '     SELECT TOP(@NUMROWS) t1.[LeafName] AS c0, t2.[nvarchar4] AS c6c9, UserData.[tp_ContentTypeId], UserData.[datetime1], UserData.[nvarchar15], t1.[ScopeId] AS c4, UserData.[nvarchar4], UserData.[tp_CheckoutUserId], t2.[tp_ID] AS c6c8, t3.[nvarchar10] AS c14c15, UserData.[int3], UserData.[tp_ModerationStatus], UserData.[tp_Level], UserData.[int5], UserData.[nvarchar12], UserData.[tp_Created], CASE WHEN DATALENGTH(t1.DirName) = 0 THEN t1.LeafName WHEN DATALENGTH(t1.LeafName) = 0 THEN t1.DirName ELSE t1.DirName + N'/' + t1.LeafName END  AS c3, t1.[Type] AS c5, t2.[nvarchar1] AS c6c7, t2.[tp_Created] AS c6c11, UserData.[int1], t4.[nvarchar10] AS c16c15, t5.[nvarchar10] AS c17c15, UserData.[tp_Modified], t1.[SortBehavior] AS c2, UserData.[nvarchar3], t2.[nvarchar6] AS c6c10, UserData.[float1], UserData.[tp_ID], t1.[IsCheckoutToLocal] AS c13, t1.[TimeCreated] AS c1, t1.[LTCheckoutUserId] AS c12, UserData.[int4], t6.[nvarchar10] AS c18c15 FROM AllUserData AS UserData WITH(INDEX=AllUserData_PK) INNER JOIN Docs AS t1 WITH(NOLOCK) ON (UserData.[tp_RowOrdinal] = 0) AND (t1.SiteId=UserData.tp_SiteId) AND (t1.SiteId = @SITEID) AND (t1.ParentId = UserData.tp_ParentId) AND (t1.Id = UserData.tp_DocId) AND ( (UserData.tp_Level = 1 OR  UserData.tp_Level =255) ) AND (t1.Level = UserData.tp_Level) AND ((UserData.tp_Level = 255 AND t1.LTCheckoutUserId =@IU OR (UserData.tp_Level = 1 AND (UserData.tp_DraftOwnerId IS NULL) OR UserData.tp_Level = 2)AND (t1.LTCheckoutUserId IS NULL OR t1.LTCheckoutUserId <> @IU ))) AND (UserData.[tp_ListID] =@LISTID) AND (UserData.[tp_CalculatedVersion] = 0 ) AND (UserData.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (UserData.[tp_DeleteTransactionId] = 0x ) LEFT OUTER LOOP JOIN AllUserData AS t2 WITH(NOLOCK,INDEX=AllUserData_PK) ON (UserData.[tp_CheckoutUserId]=t2.[tp_ID]) AND (UserData.[tp_RowOrdinal] = 0) AND (t2.[tp_RowOrdinal] = 0) AND ( (t2.tp_Level = 1) ) AND (t2.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (t2.[tp_CalculatedVersion] = 0 ) AND (t2.[tp_DeleteTransactionId] = 0x ) AND (t2.tp_ListId = @L3) AND (UserData.tp_ListId = @L4) LEFT OUTER LOOP JOIN AllUserData AS t3 WITH(NOLOCK,INDEX=AllUserData_PK) ON (UserData.[int1]=t3.[tp_ID]) AND (UserData.[tp_RowOrdinal] = 0) AND (t3.[tp_RowOrdinal] = 0) AND ( (t3.tp_Level = 1) ) AND (t3.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (t3.[tp_CalculatedVersion] = 0 ) AND (t3.[tp_DeleteTransactionId] = 0x ) AND (t3.tp_ListId = @L5) AND (UserData.tp_ListId = @L4) LEFT OUTER LOOP JOIN AllUserData AS t4 WITH(NOLOCK,INDEX=AllUserData_PK) ON (UserData.[int3]=t4.[tp_ID]) AND (UserData.[tp_RowOrdinal] = 0) AND (t4.[tp_RowOrdinal] = 0) AND ( (t4.tp_Level = 1) ) AND (t4.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (t4.[tp_CalculatedVersion] = 0 ) AND (t4.[tp_DeleteTransactionId] = 0x ) AND (t4.tp_ListId = @L5) AND (UserData.tp_ListId = @L4) LEFT OUTER LOOP JOIN AllUserData AS t5 WITH(NOLOCK,INDEX=AllUserData_PK) ON (UserData.[int4]=t5.[tp_ID]) AND (UserData.[tp_RowOrdinal] = 0) AND (t5.[tp_RowOrdinal] = 0) AND ( (t5.tp_Level = 1) ) AND (t5.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (t5.[tp_CalculatedVersion] = 0 ) AND (t5.[tp_DeleteTransactionId] = 0x ) AND (t5.tp_ListId = @L5) AND (UserData.tp_ListId = @L4) LEFT OUTER LOOP JOIN AllUserData AS t6 WITH(NOLOCK,INDEX=AllUserData_PK) ON (UserData.[int5]=t6.[tp_ID]) AND (UserData.[tp_RowOrdinal] = 0) AND (t6.[tp_RowOrdinal] = 0) AND ( (t6.tp_Level = 1) ) AND (t6.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (t6.[tp_CalculatedVersion] = 0 ) AND (t6.[tp_DeleteTransactionId] = 0x ) AND (t6.tp_ListId = @L5) AND (UserData.tp_ListId = @L4) WHERE (UserData.[tp_CalculatedVersion] = 0 ) AND (UserData.[tp_IsCurrentVersion] = CONVERT(bit,1) ) AND (UserData.[tp_DeleteTransactionId] = 0x ) AND (UserData.tp_ListID=@LISTID) AND ( (UserData.tp_Level = 1 OR  UserData.tp_Level =255)  AND ( UserData.tp_Level= 255 AND UserData.tp_CheckoutUserId = @IU OR  ( UserData.tp_Level  = 2 AND UserData.tp_DraftOwnerId IS NOT NULL OR UserData.tp_Level  = 1 AND UserData.tp_DraftOwnerId IS  NULL  ) AND ( UserData.tp_CheckoutUserId IS  NULL  OR UserData.tp_CheckoutUserId <> @IU))) AND (UserData.tp_SiteId=@SITEID) AND (UserData.tp_RowOrdinal=0) AND (t1.SiteId=@SITEID AND (t1.DirName=@DN OR t1.DirName LIKE @DNEL+N'/%') AND t1.SortBehavior=0) ORDER BY UserData.[tp_Created]  DESC ,t1.[LeafName] COLLATE Chinese_PRC_CI_AS  ASC ,UserData.[tp_ID]  ASC  OPTION (FORCE ORDER, MAXDOP 1)'
      CommandType: Text CommandTimeout: 0
      Parameter: '@LFFP' Type: UniqueIdentifier Size: 0 Direction: Input Value: '00000000-0000-0000-0000-000000000000'
      Parameter: '@SITEID' Type: UniqueIdentifier Size: 0 Direction: Input Value: '5f781af7-ecac-4610-9455-d31197daeb1a'
      Parameter: '@IU' Type: Int Size: 0 Direction: Input Value: '1073741823'
      Parameter: '@L3' Type: UniqueIdentifier Size: 0 Direction: Input Value: '3a177c8f-4a48-470e-be16-68eee47b5080'
      Parameter: '@L4' Type: UniqueIdentifier Size: 0 Direction: Input Value: 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70'
      Parameter: '@L5' Type: UniqueIdentifier Size: 0 Direction: Input Value: 'b4049485-6a59-478d-a819-82eb99f1252f'
      Parameter: '@DN' Type: NVarChar Size: 4000 Direction: Input Value: 'dc/kms/ProjectDoc'
      Parameter: '@DNEL' Type: NVarChar Size: 4000 Direction: Input Value: 'dc/kms/ProjectDoc'
      Parameter: '@LISTID' Type: UniqueIdentifier Size: 0 Direction: Input Value: 'ecc5afeb-d187-4ee8-a944-522ad7ee2e70'
      Parameter: '@NUMROWS' Type: BigInt Size: 0 Direction: Input Value: '31'
      Parameter: '@RequestGuid' Type: UniqueIdentifier Size: 0 Direction: Input Value: '042893cf-f9b6-4b97-8a7b-8ef008d7ead9'
    0.641623586237916 0.001086
    Database Tag(tzkk) SqlCommand StackTrace-Managed:    在 Microsoft.SharePoint.Utilities.SqlSession.OnPreExecuteCommand(SqlCommand command)
      在 Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock)
      在 Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)
      在 Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)
      在 Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
      在 Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView)
      在 Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()
      在 Microsoft.SharePoint.SPListItemCollection.get_Count()
      在 Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)
      在 Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()
      在 Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformSelect()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.DataBind()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.EnsureDataBound()
      在 Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()
      在 Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.CreateChildControls()
      在 Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()
      在 System.Web.UI.Control.EnsureChildControls()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Control.PreRenderRecursiveInternal()
      在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      在 System.Web.UI.Page.ProcessRequest()
      在 System.Web.UI.Page.ProcessRequest(HttpContext context)
      在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
      在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
      在 System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
      在 System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
      在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
      在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    0.642438075230232 0.000814
    Database Tag(fdz2) SQL IO Statistics: Procedure , 表 'AllUserData'。扫描计数 1,逻辑读取 94744 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 4.14087586550805 3.498438
    Database Tag(fdz2) SQL IO Statistics: Procedure , 表 'AllDocs'。扫描计数 0,逻辑读取 93777 次,物理读取 0 次,预读 0 次,lob 逻辑读取 0 次,lob 物理读取 0 次,lob 预读 0 次。 4.14103328775026 0.000157
    Monitoring Tag(b4ly) Leaving Monitored Scope (EnsureListItemsData). 执行时间=3527.5274511146 4.1439980500315 0.002965
    Monitoring Tag(nass) ____SQL 查询计数=2 4.14407585321598 0.000078
    Monitoring Tag(nass) ____执行时间=3527.5274511146 4.14415973259171 0.000084
    General Tag(g3ql) GetUriScheme(/dc/kms/ProjectDoc) 4.14560684388658 0.001447
    Monitoring Tag(b4ly) Leaving Monitored Scope (DataBinding DataFormWebPart (专业文档)). 执行时间=3534.06054400769 4.14793779656353 0.002331
    Monitoring Tag(nass) ____SQL 查询计数=2 4.14803669181418 0.000099
    Monitoring Tag(nass) ____SPRequest 对象=0 4.14810262198129 0.000066
    Monitoring Tag(nass) ____执行时间=3534.06054400769

    • 已编辑 GuYuming 2017年8月17日 6:49
    2017年8月17日 6:17

全部回复

  • 我注意到上述 Call Stack 中的一段

      在 Microsoft.SharePoint.SPListItemCollection.get_Count()
      在 Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)
      在 Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()

    然后在 SPDataSourceView.ExecuteSelect 里,可以看到如下代码:

                                if (selectArguments.RetrieveTotalRowCount)
                                {
                                    this.totalNumberOfRows = listItems.Count;
                                }

    但我始终没找到这个RetrieveTotalRowCount是在哪里初始化的。我估计是这个 .Count 的访问导致了性能差,事实上界面是分页显示的,也没有展现3万多条的总数,如果设置了 .RetrieveTotalRowCount 到 False,是不是就可以避免性能问题了呢?


    • 已编辑 GuYuming 2017年8月17日 7:27
    2017年8月17日 7:10
  • 这个问题是我想歪了, SQL 语句里包含 SELECT TOP(@NUMROWS) , 且@NUMROWS 的值是 31 ,却还有9万多次逻辑读 , 是因为 SharePoint 视图的排序被设成了 名称, 改到 按修改日期排序,并确保修改日期 在SharePoint列表设置里建了索引栏就快了。

    可惜,名称 列无法建索引 https://social.msdn.microsoft.com/Forums/office/en-US/53249712-bf3b-436b-8f15-4a73cb0ec676/issue-with-adobe-reader-generated-caml-query-list-view-threshold-exceeded?forum=sharepointgeneralprevious

    2017年8月21日 5:56