Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用过 Sql server 游标。我在数据库中插入了 10K 条记录,并在相关的一些数据中插入了多个表,但需要一些时间,所以关于如何提高 sql server 速度的任何建议。sql server 中的哪个循环库?
是的。20 年来的旧规则:不要使用光标。它们的性能非常糟糕,并且您失去了 SQL Server 为查询性能所做的 90% 的工作。开始使用您的代码并编写基于 SET 的 SQL,而不是过程循环。
虽然循环总是比提供更多控制的游标好,但您可以结合常用表表达式
https://www.techrepublic.com/blog/the-enterprise-cloud/comparing-cursor-vs-while-loop-performance-in-sql-server-2008/