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

  • Home
  • SEARCH
  • 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 3879294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:42:36+00:00 2026-05-19T22:42:36+00:00

I just read the accepted answer of this question , which left me with

  • 0

I just read the accepted answer of this question, which left me with this question.

Here’s a quote from that answer:

“But since you tagged this question with MySQL, I’ll mention a MySQL-specific tip: when your query implicitly generates a temporary table, for instance while sorting or GROUP BY, VARCHAR fields are converted to CHAR to gain the advantage of working with fixed-width rows. If you use a lot of VARCHAR(255) fields for data that doesn’t need to be that long, this can make the temporary table very large.”

As I understand it, the advantage of CHAR is that you get fixed-width rows, so doesn’t a VARCHAR in the same table mess that up? Are there any advantages of using CHAR when you have a VARCHAR in the same table?


Here’s an example:

Table with CHAR:

CREATE TABLE address (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    street VARCHAR(100) NOT NULL,
    postcode CHAR(8) NOT NULL,
    PRIMARY KEY (id)
);

Table without CHAR:

CREATE TABLE address (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    street VARCHAR(100) NOT NULL,
    postcode VARCHAR(8) NOT NULL,
    PRIMARY KEY (id)
);

Will the table with CHAR perform any better than the table without CHAR, and if so, in what situations?

  • 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-19T22:42:36+00:00Added an answer on May 19, 2026 at 10:42 pm

    “VARCHAR” basically sets a maximum length for the field and only stores the data that is entered into it, thus saving on space. The “CHAR” type has a fixed length, so if you set “CHAR(100)“, 100 character worth of space will be used regardless of what the contents are.

    The only time you will gain a speed advantage is if you have no variable length fields in your record (“VARCHAR“, “TEXT“, etc.). You may notice that Internally all your “CHAR” fields are changed to “VARCHAR” as soon as a variable length field type is added, by MySQL.

    Also “CHAR” is less efficient from a space storage point of view, but more efficient for searching and adding. It’s faster because the database only has to read an offset value to get a record rather than reading parts until it finds the end of a record. And fixed length records will minimize fragmentation, since deleted record space can be reused for new records.

    Hope it helps.

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

Sidebar

Related Questions

I just read this post about why new-line warnings exist, but to be honest
I've just read here ( http://ruby.runpaint.org/programs#lexical ) that comments are tokens. I've never thought
I just read the Wikipedia article on mock objects , but I'm still not
Just finished read this post by Greg Young, where he is talking about Microsoft
Well, I've tried to understand and read what could cause it but I just
I just read up on a performance of LINQ, and there is a HUGE
I just read a post mentioning full text search in SQL. I was just
I just read Joel Spolsky's article, Up the tata without a tutu , where
Having just read the first four chapters of Refactoring: Improving the Design of Existing
I've just read up on Thread.IsBackground and if I understand it correctly, when it's

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.