ADO.Net 和 ADO.Net 中的多个插入SP
我需要从 ado.net 插入多条记录。它应该调用 SP 进行更新。 我有多个 CSV 记录,并将它们添加到 SP 的临时表中。需要进行一些验证。它被插入/更新到主表中。
问题是使用临时表有性能瓶颈。
我已经用谷歌搜索过了。其他传递多条记录的方法可以通过使用 XML 或 sql 2008 中的表值参数来完成。
从性能角度来看,哪一种更好。就我而言,一次可能会发生 500 个并发事务。
请建议。
问候, 玛尼·M
I need to insert multiple records from ado.net. It should call a SP for updating.
I have multiple records as CSV and added them in temporary table in SP. Some Validations needs to be done that. And it get inserted/updated in to main table.
Problem is using Temp table has performance bottle necks.
I have googled it. Other ways of passing multiple records can be done by using XML or table value parameter in sql 2008.
On Performance point of view, which one is better. In my case, 500 concurrent transactions may happen at a time.
Please suggest.
Regards,
Mani.M
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这三者中,表值参数通常表现更好,而且我发现它们也更易于维护。本文讨论使用 XML、TVP 和 CSV 的性能:
http://www.adathedev.co.uk/2010/02/sql-server-2008-table-valued-parameters.html
Of the three, Table Valued Parameters usually perform better, and I find them more maintainable as well. This article discusses the performance using XML, TVP, and CSV:
http://www.adathedev.co.uk/2010/02/sql-server-2008-table-valued-parameters.html
刚刚回答了一个类似的问题,尽管它不太关注并发性,而更多地关注纯粹的性能: 在 PostgreSQL 中批量更新/更新插入。
在我对另一个问题的回答中,您只有 1 笔交易,这可以解决您的问题。
Just answered a similar question, although it was focused less on concurrency and more on pure performance: Bulk/batch update/upsert in PostgreSQL.
In my answer to the other question, you would only have 1 transaction, which would address your issue.