将富文本格式保存到sql表会占用大量空间 [英] Saving rich text format to sql table uses a lot of space

查看:602
本文介绍了将富文本格式保存到sql表会占用大量空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,当我将rtf信息保存到SQL表时,我注意到它占用了大量空间.具有1000个符号的文本通常在数据库中以rtf格式获取大约2500个符号(当我添加更多格式时,符号数会增加).程序员通常在SQL表中保存这么多的信息吗?有那么多信息正常吗?
如果我的表中包含10000个字符,那会错吗?

感谢您的任何答复,我将不胜感激!

Hi all, when i save rtf information to SQL table i notice that it consumes a lot of space. A text with 1000 symbols normally gets about 2500 symbols in rtf format in database (when I add more formatting, symbols number increase). Do programmers usually save so much information in SQL table and is it normal to have so much?
Will it be wrong if my table gets 10000 characters in it?

Thanks for any replies, I''d really appreciate them!

推荐答案

我想问一下格式化是真正的数据还是格式化以便显示.如果仅用于显示,则可能在显示数据时将其添加到报表中,并且仅需要保存实际数据(文本)本身.

但是,这取决于您的应用程序.如果要保存格式,则要么必须保存rtf数据,要么需要另外一种保存格式信息的方法.我个人认为我从来没有想过要保存所有格式信息.
I would ask whether the formatting is really data or just formatting for display. If it is for display only, perhaps that should be added in a report when you display the data and only the actual data (text) itself needs to be saved.

But, that depends on your application. If the formatting is what you want to save, you''ll either have to save the rtf data or figure another way to save the format information. Personally I don''t think I''ve ever had a case where I wanted all the format info saved.


这取决于您预测多少记录.如果会有1000-10000个这样的记录,那应该不是一个大问题,如果是上百万个,那么可能不是很好,但是为什么不呢?例如,免费的Microsoft Sql Express,每个数据库最多支持10 Gb,因此它应该能够处理大数据.商业版本不限于此值.看起来很正常.

而且,您始终可以使用压缩(System.IO.Compression.DeflateStream和System.IO.Compression.GZipStream)来减少使用的大小,这将帮助您存储较少的信息.他们应该压缩文本(rtf很好).
It depends on how much records do you predict. If there will be 1000-10000 of such records it shouldn''t be a big problem, if millions, then probably it is not very good, but why not? For example Microsoft Sql Express, which is free, supports up to 10 Gb per database, so it supposed to handle big data. Commercial versions are not limited with this value. It looks like it is quite normal.

And you always can decreased used size using compression (System.IO.Compression.DeflateStream and System.IO.Compression.GZipStream) which will help you to store less information. They should compress text (which rtf is) quite good.


这篇关于将富文本格式保存到sql表会占用大量空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆