sqlserver 使用order by 排序只获取10条数据就会慢6秒,对与这个有什么解决方法吗?
SELECT T1. FROM (SELECT thinkphp., ROW_NUMBER() OVER ( ORDER BY [createdt] desc) AS ROW_NUMBER FROM (SELECT [a].[master_id],[a].[detail_id],[a].[isProve],[a].[weight],[a].[proveNumber],[a].[operator],[a].[createdt],[b].[ware_name],c.dm as dms,[f].[fx],[f].[fxDate],[f].[fxName] FROM [dbo].[ware_detail] [a] LEFT JOIN [dbo].[ware] [b] ON [a].[ware_id]=[b].[ware_id] LEFT JOIN [dbo].[dm] [c] ON [a].[dm]=[c].[dm_id] LEFT JOIN [dbo].[ware_cf] [f] ON [a].[master_id]=f.master_id and a.detail_id=f.detail_id WHERE [a].[ware_id] = '3' AND [a].[createdt] BETWEEN '2021-02-21 00:00:00' AND '2021-02-23 23:59:59' AND ( [a].[delete] is null or [a].[delete]=0 ) AND [f].[fx] = '0') AS thinkphp) AS T1 WHERE (T1.ROW_NUMBER BETWEEN 0 + 1 AND 0 + 10)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我记得没错的话 SqlServer 客户端有一个执行计划的按钮, 你可以了解一下这个东西,可以帮助你分析sql语句慢的问题