SQL Server 数据格式
我正在为我的应用程序编写一个高性能数据检索/存储类,它使用 SqlDataReader 从 SQL 服务器检索数据。
出于好奇,我想知道来自 SQL Server 的数据是什么形式。人物?二进制?还有其他形式吗?
不幸的是,我无法在办公室进行任何数据包嗅探,这是我认为可以找到答案的一种方式。
编辑:这个问题的目的是确定从 SQL Server 检索数据的格式,以便在将数据放入数据结构之前允许尽可能少的操作。
这个问题与我之前的一个问题有关,我发现转换之间的区别将数据格式转换为字符串会对性能产生重大影响。
I am working on writing a high-performance data retrieval/storage class for my application that uses a SqlDataReader to retrieve data from a SQL server.
Out of curiosity, I wanted to know what form the data comes in from the SQL server. Characters? Binary? Some other form?
Unfortunately I cannot do any packet sniffing at my office, which is one way I think this answer could be found.
EDIT: The purpose of this question was to determine the format the data is retrieved in from SQL server to allow for as little manipulation as possible before placing it in a data structure.
This question is in relation to a previous question of mine where I found the difference between converting data formats into strings produces a significant impact on performance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该格式记录在表格数据流协议规范< /a>.话虽这么说,协议和线路格式在很大程度上是无关紧要的,如果您检索如此多的数据而对传输速度很重要,那么您已经走上了错误的道路。
确保您的数据访问得到优化,最重要的是您的数据模型设计良好并且符合预期的工作负载(换句话说:为关键查询提供覆盖索引)。
如果您检索大块数据(例如存储在数据库中的媒体文件),则有一些特定的方法可以使用
SqlCommand
类,即SequentialAccess
行为标志:有关如何使用此功能的示例,请参阅 通过 ASP.Net MVC 从 SQL Server 下载和上传图像。
The format is documented at Tabular Data Stream Protocol Specification. That being said, the protocol and wire format are largely irrelevant, if you retrieve so much data as to for the speed of transfer to matter you are already deep down the wrong path.
Make sure your data access is optimized, and most importantly your data model is well designed and matches the workload expected (in other words: have covering indexes for the critical queries).
If you retrieve large chunks of data (eg. media files stored in the database) then there are some specific ways to use the
SqlCommand
class, namely theSequentialAccess
behavior flag:For an example of how to use this, see Download and Upload images from SQL Server via ASP.Net MVC.