如何计算在SQL中插入1条记录所需的时间 [英] how to calculate the required time to insert 1 record in SQL

查看:94
本文介绍了如何计算在SQL中插入1条记录所需的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VBA代码中使用了ADODB.connection到SQL dB.
在此应用程序中,我想将记录从一个数据库转移到另一个数据库.我已经使用ADODB.Recordset从表&中读取数据.然后将其一一存储到表中.将记录插入表中需要花费大量时间.
任何人都可以说出如何在SQL中计算插入查询所需的时间吗?

i have used the ADODB.connection to SQL dB in VBA code .
in this application i want transfer the records from the one database to another database .i have used the ADODB.Recordset to read the data from the table & then stored one by one into the table .it takes lots of time to insert the record into the table .
any one can tell the how to calculate the required time of the insert query in SQL ?

table total row =10796246
table column =31
time required to stored table rows = ?

推荐答案

这种方法可以为您提供大约一千万条记录插入时间的良好近似值:

计算1000条记录的插入时间,然后将结果乘以10796,您将获得大约10796246条记录的插入时间.

如果用不到1毫秒的时间将1000更改为较大的值,或者如果认为计算近似值很大则将其更改为较小的值.当然,更改1000后也应该更改乘法数.

要计算代码的执行时间,请阅读以下页面:
http://support.microsoft.com/kb/213481 [ http://www.stellarpc.com/articles/board.aspx?id=37 [ ^ ]

请记住,如果发生硬件更改,请再次计算该近似值.

希望对您有所帮助.
This approach can give you a good approximation for about 10 million record insertion time:

Compute the insertion time for 1000 record and then multiply the result to 10796 and you will have the insertion time for 10796246 records approximately.

Change 1000 to a greater value if it took less that 1 milliseconds to do that or make it smaller if you think that it is very large for calculating an approximation. Of course you should change multiplication number too after changing 1000.

To calculate execution time of a code read these pages :
http://support.microsoft.com/kb/213481[^]

http://www.stellarpc.com/articles/board.aspx?id=37[^]

Remember to calculate this approximation again in case of hardware change.

Hope it helps.


这篇关于如何计算在SQL中插入1条记录所需的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆