1

My server default CHARSET is UTF-8 (set in my.cnf). I create tables like

CREATE TABLE t1
(
ID int(11) unsigned NOT NULL AUTO_INCREMENT,
Title varchar(255),
PRIMARY KEY(ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci KEY_BLOCK_SIZE=2

but some tables have only int columns. Is it beneficial to use latin charset for them? Or is it better to have all tables with UTF-8 charset for consistency?

CREATE TABLE t2
(
ID int(11) unsigned NOT NULL,
TagID int(11) unsigned NOT NULL,
PRIMARY KEY(ID,TagID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci KEY_BLOCK_SIZE=1

vs.

CREATE TABLE t2
(
ID int(11) unsigned NOT NULL,
TagID int(11) unsigned NOT NULL,
PRIMARY KEY(ID,TagID)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE latin1_swedish_ci KEY_BLOCK_SIZE=1
2
  • I don't remember ever seeing a table with a KEY_BLOCK_SIZE specification. What is your goal behind it?
    – Rick James
    Feb 4 at 7:10
  • @RickJames it's for the table compression. KEY_BLOCK_SIZE is used instead of ROW_FORMAT=COMPRESSED to enhance the compression in accordance with the table structure.
    – Googlebot
    Feb 4 at 7:29
3

The character set and collation of a table affects the newly created columns in that table. It also affects char/text columns without a specified character set/collation.

So your int only tables don't have any specific difference because of character set, until you add a column that uses it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.