4

What is the best way to store messaging texts in large/big web sites: BLOB or ordinary text in table or something else? Database: MySQL.

ilhan
  • 8,700
  • 35
  • 117
  • 201

2 Answers2

3

There are a lot of questions you need to ask yourself when making that decision. There's a very detailed article, To BLOB or not to BLOB, that is the question: Whether to store string in BLOB, or CHAR, or VARCHAR? (archived), that talks about some of the things to consider.

drac_o
  • 427
  • 5
  • 11
Ashish Agarwal
  • 6,215
  • 12
  • 58
  • 91
  • 1
    You really should not rip-off an entire article and post the text here. It would be pretty poor form even if you had have included an attribution, which you did not. Original here: http://www.volny.cz/iprenosil/interbase/ip_ib_strings.htm – APC Feb 07 '10 at 16:41
  • I agree with @APC. A summary would be fine with the link, but don't just copy an entire article without giving proper attribution. – Bill the Lizard Feb 07 '10 at 17:25
  • Thnax Bill for suggestion,will do the same form time ownwards – Ashish Agarwal Feb 07 '10 at 19:18
  • 1
    Hmm seems the link is gone, if you only would have copied the text, we could still read it :-) – Jettro Coenradie Jun 08 '19 at 13:24
2

If by "messages" you mean something like SMS or IRC, stuff with a defined limit then I think VARCHAR is the most appropriate. If your messages can really be any size then TEXT would be better.

But I wouldn't have thought BLOB was suitable for anything except perhaps attachments (assuming your system has them). BLOBs are meant for binary files (e.g. images, Word documents) not pure text.

APC
  • 144,005
  • 19
  • 170
  • 281