Jump to content


Photo

blob or longtext


  • Please log in to reply
3 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 29 October 2006 - 04:39 PM

For larger amount's of text when saved within a database, is it better to use longtext, or blob datatypes.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 October 2006 - 05:13 PM

Well blob (which is the same as text) can only store just over 65,500 characters which is about 63KB of text. However longtext allows you to store dramatically more characters just under 4.3 trillion characters! Have a look at this MySQL Cheat Sheet to see what each data types holds.
You'll probably want to use MEDIUMTEXT instead, which holds about 17 million characters, which is about 16MB.

1 character is a byte.

#3 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 29 October 2006 - 05:29 PM

There's other considerations to think about other than just how many bytes a data type will hold. For instance, if you ever plan on using full-text searches and create a full-text index, then use a text based data types instead of blobs. You can't create full-text indexes for blobs.

http://dev.mysql.com...ext-search.html

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 29 October 2006 - 07:31 PM

If it's text, use TEXT... if it's binary data, use BLOB.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users