2

我在一个命令中使用从 ASP.NET 作为批处理发送的 17000 行代码长脚本来创建新数据库缓慢的问题。问题是在高峰时段执行此脚本有时需要 20 多秒。如果我在 SQL Server Management Studio 中运行此脚本,则需要 2 秒。

根据请求创建数据库、将脚本放入存储过程、数据库克隆、预创建以及重命名数据库的最佳实践是什么?我们需要确保它与负载下的并发环境兼容。

谢谢你。

4

1 回答 1

0

Sending 17000 lines over the wire to a SQL server seems like an awful amount of overhead and slow as all get out. So does using the SQL client for ASP.NET to do anything like this.

Yes, I am in favor of you using a stored proc to do this. Not too sure about the DB cloning and re-naming operation; I would bet you could get away from that by using parameters to your stored proc to define that.

于 2013-03-26T20:51:25.123 回答