简体   繁体   English

datareader vs bcp?

[英]datareader vs bcp?

For reading the data from the database which is faster BCP or Data reader? 为了从数据库中读取数据,哪个是更快的BCP或数据读取器? The data will be around 50,000 records the size will be approximately around 170 MB. 数据将约为50,000条记录,大小将约为170 MB。 Please let me know if you need any more information? 请让我知道是否需要更多信息?

You should use the DataReader , it is designed for buffering DataSets in memory: 您应该使用DataReader ,它设计用于在内存中缓冲DataSet:

Using the DataReader can increase application performance both by retrieving data as soon as it is available, rather than waiting for the entire results of the query to be returned, and (by default) storing only one row at a time in memory, reducing system overhead. 使用DataReader可以通过以下方式提高应用程序性能:在数据可用时立即检索数据,而不是等待查询的全部结果返回,并且(默认情况下)一次仅在内存中存储一​​行,从而减少了系统开销。

Assuming you are consuming the data in a application and not writing an export application, then BCP would only slow you down. 假设您正在使用应用程序中的数据,而不是编写导出应用程序,那么BCP只会使您减速。 BCP would be the appropriate choice if you were only concerned with doing an export. 如果您只关心进行导出,则BCP是合适的选择。

what do you need to do with the data? 您需要如何处理数据? You should use BCP if you want to export to a text file for example. 例如,如果要导出到文本文件,则应使用BCP。

Data reader is a component you would use on a .net application to display data on the UI. 数据读取器是您将在.net应用程序上用来在UI上显示数据的组件。

DataReader仍然更合适。我认为BCP是另一个工具,并具有另一个作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM