2500 个对象并不多... imo... 但是,我有一个项目试图用 90,000 + 行来执行此操作,它实际上杀死了 chrome... 解决方案是服务器端分页... 我创建了淘汰赛绑定分页这将要求每页少量的行。这些参数是在我的存储过程中处理的。您也可以使用服务器端语言处理分页参数。这需要更多的服务器访问,但权衡是非常值得的。
这里有一些 SQL 代码...
declare @rowCount int = 25;
Select MainSearchWithRowNumbers.*
FROM
(SELECT
ROW_NUMBER() OVER () As RowNumber
,Count(*) OVER () as TotalRows
,CEILING(CAST(Count(*) OVER () as FLOAT) / CAST(@rowCount as FLOAT)) AS TotalPages
,*
FROM
(
SELECT
-- ROW_NUMBER() OVER (ORDER BY CarcassRemovalId) AS AbsRowNumber
Count(*) OVER () AS AbsTotalRows
,CEILING(CAST(Count(*) OVER () AS FLOAT) / CAST(@rowCount AS FLOAT)) AS AbsTotalPages
,*
FROM YOURTABLE)
) as MainSearch
) as MainSearchWithRowNumbers
WHERE
(@page is null)
or (
(RowNumber <= @page * @rowCount)
and (RowNumber > (@page - 1) * @rowCount)
)