简体   繁体   English

在SQL数据库中保存大型文本数据(保存在stringbuilder中)的最佳方法?

[英]Best way to save large text data (hold in a stringbuilder) in SQL Database?

I am using a desktop based windows form application ..need to save a huge text field in sql sever db .Which one is better 我正在使用基于桌面的Windows窗体应用程序..需要在sql服务器数据库中保存一个巨大的文本字段。哪个更好

  1. varbinary(max) VARBINARY(最大值)

  2. varchar(max) VARCHAR(最大值)

  3. Blob 斑点

  4. Any other 任何其他

Can anyone please explain the pros and cons .! 任何人都可以请解释一下优缺点。

As it will be run in users desktop don't want to make an overhead (making the application slow/Crash their application) 由于它将在用户桌面上运行,因此不希望增加任何开销(使应用程序变慢/使应用程序崩溃)

Since you will store "huge text", assumed to be greater than 64kb, you should use MEDIUMTEXT or LONGTEXT . 由于将存储假定大于64kb的“大文本”,因此应使用MEDIUMTEXTLONGTEXT

MEDIUMTEXT – up to 16MB
LONGTEXT – up to 4GB

The actual problem will be data storage in terms of performance. 实际的问题将是性能方面的数据存储。 TEXT and BLOB is stored off the table with the table just having a pointer to the location of the actual storage; TEXTBLOB存储在表外,该表仅具有指向实际存储位置的指针。 depending on your hardware especially disk/io performance this may create a bottleneck. 根据您的硬件(尤其是磁盘/ io性能),这可能会造成瓶颈。

varbinary and blob is for binary data. varbinaryblob用于二进制数据。

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

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