VARCHAR versus TEXT or LONGTEXT

user1794491 picture user1794491 · Nov 2, 2012 · Viewed 17.2k times · Source

If a blog post is 200 characters long, will varchar(6500) only consume the space of varchar(200)?

Will this be more efficient than using TEXT or LONGTEXT?

Answer

Waqar Alamgir picture Waqar Alamgir · Nov 2, 2012

TEXT is stored off the table it has reference of it only.

While

VARCHAR is stored inline with the table and usually used with less size. You can use it to max 65535 but very bad actually in terms of performance.

So that you can optimized table and queries, performance may very with DBMS. If you have variable but larger string I would suggest using TEXT