MySQL Forums
Forum List  »  Newbie

Re: text vs longtext
Posted by: Anthony Willard
Date: June 15, 2007 01:08PM

A TEXT column can hold 64K (65,535 bytes) worth of data; LONGTEXT can hold 4GB (4,294,977,295 bytes).

While both can hold the same 3,000 byte string, the LONGTEXT uses larger sized attributes to contain the 3,000 bytes than the TEXT version. Over several million rows of data, those bytes add up.

It's like storing a simple counter, on a claim for instance, where the value will only every be less than 100 in an INT field - a field that can hold 4GB, when something like TINYINT would work just fine. And save 3 bytes per field per record. That can be significant over several millions of records. With a million records, you save 3 MB in storage space; if your record is only 30 bytes wide, you are saving 10% by opting for a more efficient storage type.

Really, it boils down to how much overkill you really want. Is the possibility of future necessity of more storage worth wasting the space (space equates to time to read/write == performance)?

Options: ReplyQuote


Subject
Written By
Posted
June 15, 2007 12:43PM
Re: text vs longtext
June 15, 2007 01:08PM
June 16, 2007 10:25AM
June 16, 2007 03:20PM
June 16, 2007 04:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.