@MichaelRoosz opened this Issue on April 18th 2022 Contributor

After upgrading to utf8mb4 via
./console core:convert-to-utf8mb4
as documented here:
https://matomo.org/faq/how-to-update/how-to-convert-the-database-to-utf8mb4-charset/

All columns of all tables of type "text" (text, mediumtext, etc) have automatically been increased in size by the sql server (MariaDb 10.7).

For example, before:

CREATE TABLE matomo_session (
  id varchar(191) NOT NULL,
  modified int(11) DEFAULT NULL,
  lifetime int(11) DEFAULT NULL,
  data mediumtext DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

after:

CREATE TABLE matomo_session (
  id varchar(191) NOT NULL,
  modified int(11) DEFAULT NULL,
  lifetime int(11) DEFAULT NULL,
  data longtext DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

The logic behind this is documented here:
https://mariadb.com/kb/en/setting-character-sets-and-collations/#table-level

For example, an ascii TEXT column requires a single byte per character, so the column can hold up to 65,535 characters. If the column is converted to utf8, 3 bytes can be required for each character, so the column will be converted to MEDIUMTEXT to be able to hold the same number of characters.

As this might be unexpected, I think it would be great to mention this behavior here: https://matomo.org/faq/how-to-update/how-to-convert-the-database-to-utf8mb4-charset/

@peterhashair commented on April 19th 2022 Contributor

@MichaelRoosz thanks for reporting this, will update the FAQ.

Powered by GitHub Issue Mirror