Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:48:38+00:00 2026-05-24T02:48:38+00:00

I am optimizing DB and there is something which is not clear to me

  • 0

I am optimizing DB and there is something which is not clear to me about fixed-length data types.

As far as I know these data types are fixed-length:

  • CHAR(n)
  • DATE
  • TIME
  • DATETIME
  • TINYINT
  • SMALLINT
  • MEDIUMINT
  • INT
  • FLOAT
  • DOUBLE

And these are variable-length:

  • TEXT
  • VARCHAR
  • BLOB

Please correct me if I am wrong!

Now, my question is: Are these data types fixed-length or variable-length?

  • TIMESTAMP
  • ENUM

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:48:39+00:00Added an answer on May 24, 2026 at 2:48 am

    You are not correct on some datatypes.

    DATETIME/TIMESTAMP

    TIMESTAMP and DATETIME are similar, however TIMESTAMP uses only half the storage space when compared to DATETIME. There are however notable disadvantages to using TIMESTAMP so you should check the official docs to see which one you need. But most of the the DATETIME would be the better choice.

    You don’t have to worry about fix/variable lengths for this datatype

    NUMBERS

    You are able to store integer by setting a length i.e int(20) but in terms of storage it has no difference and hence has no meaning.

    TINYINT SMALL INT MEDIUMINT BIGINT

    These datatypes require 8, 16, 24, 32, and 64 bits of storage space respectively. Each of them has different maximum and minimum values. If you are sure your values will not exceed a certain number, you should choose the smallest int datatype to conserve space and improve performance. You should consult the official docs for more information on the figures.

    FLOAT and DOUBLE are approximate calculations and you don’t have to specify a precision. Setting a precision and inserting a value beyond the specification, your value will be rounded to the specification. Again see the official docs for this.

    VARCHAR

    VARCHAR, as you expect is variable-length, but keep in mind, don’t specify something like VARCHAR(100) when you only need 5 characters, because although the length is variable when stored on disk, it takes the length you specify when working with RAM, so you will be wasting precious memory.

    BLOB and TEXT

    BLOB and TEXT are stored in a specially way, depending on the storage engine you use. They are usually stored in an “external” area. You should avoid using this unless if the string is VERY long. This datatype cannot index the full length and also is not supported by the Memory and so is not used by the system’s memory. When calling for it a temp table will be created on disk with the MyISAM storage engine and this would cause a huge performance degradation.

    ENUM

    This is very compact and you set specific values to a field when you create a table. The strings are fixed and changing an ENUM column requires an ALTER TABLE, so you won’t have to worry about fix/variable lengths for this one.

    EDIT:

    I found a page in the official docs that answers all your questions Data Type Storage Requirements

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The MySQL 5.4 documentation, on Optimizing Queries with EXPLAIN , says this about these
I am trying to learn a bit about optimizing my jQuery code... Is there
The Situation: I'm optimizing a pure-java implementation of the LZF compression algorithm, which involves
Giving small background to my requirement and what i had accomplished so far: There
I'm just optimising my code and if there is a function that does something
I've got a project where I am not able to use LLVM optimizing because
I have a small problem developing/optimizing a web page. I know it is good
Are there any tips / best practices / secrets for optimizing the size of
Is there any way to indicate to the compiler that you know the value
We have a postgres database which a lot of scripts connect to. Crucially, there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.