[英]If I Query a SQL Server VarBinary(MAX) Column, Will the Entire File be Loaded In Memory?
My application is using SQL Server 2008 and we need to add functionality for users to optionally be able to save any file of any size to a database table. 我的应用程序使用SQL Server 2008,我们需要为用户添加功能,以便可选地将任何大小的任何文件保存到数据库表中。 I have set up the table similar to this format:
我已经设置了类似于这种格式的表:
int (indentity PK)
(This is also a foreign key to a different table) int (indentity PK)
(这也是不同表的外键) varbinary(max)
varbinary(max)
varchar(1000)
varchar(1000)
The FileStorage
table has a zero-to-one relationship to another table Documentation
. FileStorage
表与另一个表Documentation
具有零对一关系。 The idea is that users can write either write some text, upload a file, or both. 这个想法是用户可以写一些文本,上传文件,或两者兼而有之。
This table looks as follows: 该表如下:
int (identity PK
, FK to an "IrrelevantInterestingObject" table) int (identity PK
,FK到“IrrelevantInterestingObject”表) varchar(max)
varchar(max)
int (FK
to aforementioned FileStorage table) int (FK
到前面提到的FileStorage表) My question is this: When I query the Documentation
table using Entity Framework 5, and a file is present in the database, will the entire file be stored in memory? 我的问题是:当我使用Entity Framework 5查询
Documentation
表,并且数据库中存在一个文件时,整个文件是否会存储在内存中? If yes, what would a reasonable threshold be before there is a noticeable performance issue? 如果是,在出现明显的性能问题之前,合理的阈值是多少?
If you query Documentation
table no data from related FileStorage
table will be loaded until you load the relation either through eager, explicit or lazy loading. 如果查询
Documentation
表,则不会加载来自相关FileStorage
表的数据,直到您通过eager,explicit或lazy加载加载关系。 Once you use any such method or query FileStorage
directly whole FileData
for every retrieved record will be loaded to memory. 一旦你使用任何这样的方法或查询
FileStorage
直接将整个FileData
为每个检索到的记录加载到内存中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.