Todd Jenk
Todd Jenk

Reputation: 311

How important is the TYPE of FIELD when building a database schema?

When selecting a field type there are lots of options that are based on what data will be stored but how important is it that I select a specific type? If I am using a single character integer or boolean whats the harm in making the type LONGTEXT?

Does it take up more data to store it that way?

Thanks.

Upvotes: 0

Views: 20

Answers (1)

Darrell
Darrell

Reputation: 648

If you know what type of data you are going to use, then use that type. A bit is a boolean and takes a single bit of data apposed to an integer which takes 2 bytes. So using the proper data types is important in not using large quantities of memory which would lead to slow queries.

LONGTEXT size in bytes is equal to the (number of characters + 1)

Upvotes: 1

Related Questions