我有一个Qt应用程序,它读取一个特殊的文本文件,解析它并将大约100000行插入到firebird数据库中的临时表中。然后启动一个存储过程来处理这个临时表,并将一些更改应用于永久表。在firebird上插入100000行到内存中的临时表需要大约8秒.
现在,我需要使用2008实现这样的行为。如果我使用简单的串行插入,100000行大约需要76秒。不幸的是,太慢了。我看了以下几种方法:
所以,请告诉我,什么是提高插入速度从客户端应用程序到MSSSQL2008的正确方法。
谢谢。
发布于 2012-03-21 08:35:25
您可以使用通过OLE DB或ODBC接口提供的批量复制操作。
这的MSDN文章似乎在整个过程中牵着您的手,对于ODBC:
- The name of the table or view to bulk copy from or to.
- Specify NULL for the name of the data file.
- The name of an data file to receive any bulk copy error messages (specify NULL if you do not want a message file).
- The direction of the copy: DB\_IN from the application to the view or table or DB\_OUT to the application from the table or view.
如果您需要大容量复制函数的跨平台实现,请查看FreeTDS。
https://stackoverflow.com/questions/9801017
复制相似问题