Re: How large space will be occupied by mysql for a varchar utf8 column?
Posted by:
feng guo
Date: March 06, 2016 08:58PM
Rick James Wrote:
-------------------------------------------------------
> "use a varchar utf8 column other than char utf8
> column" -- I don't under stand what you are
> saying.
>
> 'a' occupies 1 byte in any utf8 VARCHAR or 3 bytes
> in any utf8 CHAR column.
> 'á' occupies 2 bytes in any utf8 VARCHAR or 3
> bytes in any utf8 CHAR column.
> Each Japanese character occupies 3 bytes in any
> utf8 VARCHAR or 3 bytes in any utf8 CHAR column.
>
> 'a' and 'á' can be represented in a CHARACTER SET
> latin1 column, but no Japanese characters can.
> Each takes 1 byte, whether CHAR or VARCHAR.
>
> Chinese has an extra wrinkle, since some
> characters need 4 bytes. To allow for this, you
> need MySQL's utf8mb4.
>
> Back to the question... How much space does text
> take when using VARCHAR with CHARACTER SET
> ut8f?...
>
> * 1 or 2 bytes for a length field
> * 1-3 bytes per character
>
> 'aá' in VARCHAR(10) CHARACTER SET utf8 will take
> the sum of:
> 1 for length
> 1 for 'a'
> 2 for 'á'
> for a total of 4 bytes. That's a lot less than a
> fixed 30 for CHAR(10).
>
> If that fails to explain it adequately, ask your
> question a different way.
I got it,thx!
Subject
Written By
Posted
February 28, 2016 10:19PM
February 29, 2016 10:14AM
February 29, 2016 08:08PM
Re: How large space will be occupied by mysql for a varchar utf8 column?
March 06, 2016 08:58PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.