It makes a difference to use LONGTEXT instead of VARCHAR(255)

Asked

Viewed 335 times

2

I wonder if using LONGTEXT instead of VARCHAR(255) would cause more "lag", which would have a greater advantage ??

1 answer

5


Yes, it makes a difference.

These two types of data are stored in different ways in the database and have different functions. For example, you can index a column of the type VARCHAR, but cannot index a column of the type TEXT or LONGTEXT

Just use LONGTEXT if it is to store a large amount of text in that column (it can store up to 4GB). Otherwise, for simpler textual information, prefer VARCHAR.

  • Let’s say I’ll keep the filename, since I don’t know the size of that name, recommend me to use which ??

  • @Lucascarezia VARCHAR(255) is sufficient in that case.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.