简体   繁体   English

从SQL Server中的Sproc返回到ADO.NET应用程序的最大数据量是多少

[英]What is the maximum amount of data that can be returned from a sproc in sql server to ADO.NET application

We have a windows service that needs to retrieve all the Orders of a Customer. 我们有一个Windows服务,需要检索客户的所有订单。 There can be cases where a customer can have large number of Orders. 在某些情况下,客户可以拥有大量订单。 So wanted to know if there was a known limit on the size of data that can be returned from a sproc in SQL Server to ADO.NET application. 因此想知道是否存在可以从SQL Server的存储过程返回到ADO.NET应用程序的数据大小的已知限制。 I can then calculate the average size of row in the table and provide the max Orders per customer limit. 然后,我可以计算表中行的平均大小,并提供每个客户最大订单数限制。 Thanks. 谢谢。

Since you are using ADO.NET, DataReader supports the max data types. 由于您使用的是ADO.NET,因此DataReader支持最大数据类型。 You will have to use a batching strategy if you are dealing with massive result sets. 如果要处理大量结果集,则必须使用批处理策略。

Large object (LOB) data types are those that exceed the maximum row size of 8 kilobytes (KB). 大对象(LOB)数据类型是那些超出最大行大小8 KB的数据类型。 SQL Server provides a max specifier for varchar, nvarchar, and varbinary data types to allow storage of values as large as 2^32 bytes. SQL Server为varchar,nvarchar和varbinary数据类型提供了一个最大说明符,以允许存储最大2 ^ 32字节的值。 Table columns and Transact-SQL variables may specify varchar(max), nvarchar(max), or varbinary(max) data types. 表列和Transact-SQL变量可以指定varchar(max),nvarchar(max)或varbinary(max)数据类型。 In ADO.NET, the max data types can be fetched by a DataReader , and can also be specified as both input and output parameter values without any special handling. 在ADO.NET中,最大数据类型可以由DataReader获取 ,也可以将其指定为输入和输出参数值,而无需任何特殊处理。 For large varchar data types, data can be retrieved and updated incrementally. 对于大型varchar数据类型,可以增量方式检索和更新数据。

https://msdn.microsoft.com/en-us/library/bb399384(v=vs.110).aspx https://msdn.microsoft.com/zh-CN/library/bb399384(v=vs.110).aspx

I just found following SO post which is also relevant. 我刚刚发现下面的帖子也很重要。

SQL Server and SqlDataReader - Trillion Records - Memory SQL Server和SqlDataReader-万亿记录-内存

Apparently I cannot repeat this enough: There is no row limit. 显然,我不能再重复一遍了: 没有行数限制。

The maximum size of a SQL Server database is, if I recall correctly apprx 500,000 terabytes . 如果我没有记错的话,SQL Server数据库的最大大小是大约500,000 TB You are nowhere near that, plus, there is no limit to the number of rows returned . 距离您不远,而且返回的行数没有限制 Your interface method might have a limit, but if you are using a .Net streaming method like a datareader , the only limit is your time and patience (and your client's memory or storage if you are trying to retain them all at once). 您的接口方法可能有一个限制,但是如果您使用的是.net流式传输方法(如数据datareader ,则唯一的限制就是您的时间和耐心(如果要一次全部保留它们,则是客户端的内存或存储)。

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

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