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 6955329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:43:20+00:00 2026-05-27T14:43:20+00:00

It says in MySQL 5.6 manual that: Values for DECIMAL (and NUMERIC) columns are

  • 0

It says in MySQL 5.6 manual that:

Values for DECIMAL (and NUMERIC) columns are represented using a binary format that packs nine decimal (base 10) digits into four bytes. Storage for the integer and fractional parts of each value are determined separately. Each multiple of nine digits requires four bytes, and the “leftover” digits require some fraction of four bytes. The storage required for excess digits is given by the following table:

+----------------------------------+
|Leftover Digits | Number of Bytes |
+----------------------------------+
|       0        |        0        |
+----------------------------------+
|       1        |        1        |
+----------------------------------+
|       2        |        1        |
+----------------------------------+
|       3        |        2        |
+----------------------------------+
|       4        |        2        |
+----------------------------------+
|       5        |        3        |
+----------------------------------+
|       6        |        3        |
+----------------------------------+
|       7        |        4        |
+----------------------------------+
|       8        |        4        |
+----------------------------------+

My question is, if the digits are less than nine on each side of the decimal, would it still use up 4 bytes or will they be considered as “leftovers“?

  • 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-27T14:43:21+00:00Added an answer on May 27, 2026 at 2:43 pm

    I did some measurements using MyISAM table to get the answer by comparing the file size of the table dec.MYD after adding some columns to six rows of data. Here is what I get:

    Original:
    -rw-rw----. 1 mysql mysql   54 Dec 17 18:49 dec.MYD
    
    Add one column of DECIMAL(2,1):
    -rw-rw----. 1 mysql mysql   66 Dec 17 18:51 dec.MYD
    
    Further add one column of DECIMAL(4,1):
    -rw-rw----. 1 mysql mysql   84 Dec 17 18:51 dec.MYD
    

    The Conclusion:

    DECIMAL(2,1) requires (66-54)/6 = 2 bytes in total
    DECIMAL(4,1) requires (84-66)/6 = 3 bytes in total
    

    Note that testing is not so straight forward as the first column seems to be always 7 bytes regardless of whether it is DECIMAL(2,1) or INT. You need to add more columns to reproduce the above result.

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

Sidebar

Related Questions

The mysql manual says that SET NAMES 'x' is equivalent to SET character_set_client =
the MySQL manual says that a CASE statement (the WHEN part) can contain a
says if i develop a Ruby on Rails application using Rails 2.3.2, will that
I have an incredibly simple query (table type InnoDb) and EXPLAIN says that MySQL
The MySQL manual (http://dev.mysql.com/doc/refman/5.1/en/charset-syntax.html) says: There are default settings for character sets and collations
A tool that I am trying to install says: MySQL server data directory needs
The MySQL 5.4 documentation, on Optimizing Queries with EXPLAIN , says this about these
MSDN says that you should use structs when you need lightweight objects. Are there
Question says it all, I've got a 500,000 line file that gets generated as
I am trying to insert data from a csv file into mysql using BigDump.

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.