Swisscom MariaDb Ent 的默认 table 存储格式是什么?
What is the default table storage format for Swisscom MariaDb Ent?
创建这样的 table 时
CREATE TABLE `dummy` (
`userid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`providerid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`provideruserid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
并像下面这样定义 PK:
ALTER TABLE dummy ADD PRIMARY KEY (userid,providerid,provideruserid);
我收到这个错误:
Error: Specified key was too long; max key length is 767 bytes
我认为以下设置正确,因此很可能不是问题所在:
innodb_file_format=Barracuda
innodb_file_per_table=ON
innodb_large_prefix=ON
很可能是 table 存储格式导致了这里的问题,但我无法检查定义的默认值。
根据 documentation,MariaDB(自 10.2.2 起)的默认 table 存储格式是 DYNAMIC
- 如果是 DYNAMIC
那么这将是完美的,但这似乎并非如此。
有谁知道 Swisscom MariaDB Ent 中默认的 table 存储格式。为什么不是 DYNAMIC
? (可能 :))
我们在珠三角的 MariaDB 版本:
select VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.1.22-MariaDB |
+-----------------+
1 row in set (0.00 sec)
引自 MariaDB 知识库 XtraDB/InnoDB Storage Formats
Compact
Compact
was the default format until MariaDB 10.2.1, and is suitable
for general use if the Antelope file format is used. It was introduced
in MySQL 5.0.
In the Compact
storage format (as in Redundant) BLOB
and TEXT
columns
are partly stored in the row page. At least 767 bytes are stored in
the row; values which exceed this value are are stored in dedicated
pages. Since Compact
and Redundant rows maximum size is about 8000
bytes, this limits the number of BLOB
or TEXT
columns that can be used
in a table. Each BLOB
page is 16KB, regardless the size of the data.
Other columns can be stored in different pages too, if they exceed the
row page's size limit.
我们实验室的 MariaDB 版本(即将部署到 Prd)。这 relevant line in bosh release。
select VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.1.26-MariaDB |
+-----------------+
1 row in set (0.00 sec)
如何修复 Swisscom Application Cloud 上的错误 ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.
(查看差异 ROW_FORMAT=DYNAMIC
):
MariaDB [Whosebug]> CREATE TABLE `dummy` (
-> `userid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
-> `providerid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
-> `provideruserid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
-> ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Query OK, 0 rows affected (0.02 sec)
MariaDB [Whosebug]> ALTER TABLE dummy ADD PRIMARY KEY (userid,providerid,provideruserid);
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [Whosebug]> show index from dummy;
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| dummy | 0 | PRIMARY | 1 | userid | A | 0 | NULL | NULL | | BTREE | | |
| dummy | 0 | PRIMARY | 2 | providerid | A | 0 | NULL | NULL | | BTREE | | |
| dummy | 0 | PRIMARY | 3 | provideruserid | A | 0 | NULL | NULL | | BTREE | | |
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)
复制粘贴代码如下:
CREATE TABLE `dummy`
(
`userid` VARCHAR(255) collate utf8mb4_unicode_ci NOT NULL,
`providerid` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`provideruserid` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL
)
engine=innodb row_format=dynamic DEFAULT charset=utf8mb4 COLLATE=utf8mb4_unicode_ci;
创建这样的 table 时
CREATE TABLE `dummy` (
`userid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`providerid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`provideruserid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
并像下面这样定义 PK:
ALTER TABLE dummy ADD PRIMARY KEY (userid,providerid,provideruserid);
我收到这个错误:
Error: Specified key was too long; max key length is 767 bytes
我认为以下设置正确,因此很可能不是问题所在:
innodb_file_format=Barracuda
innodb_file_per_table=ON
innodb_large_prefix=ON
很可能是 table 存储格式导致了这里的问题,但我无法检查定义的默认值。
根据 documentation,MariaDB(自 10.2.2 起)的默认 table 存储格式是 DYNAMIC
- 如果是 DYNAMIC
那么这将是完美的,但这似乎并非如此。
有谁知道 Swisscom MariaDB Ent 中默认的 table 存储格式。为什么不是 DYNAMIC
? (可能 :))
我们在珠三角的 MariaDB 版本:
select VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.1.22-MariaDB |
+-----------------+
1 row in set (0.00 sec)
引自 MariaDB 知识库 XtraDB/InnoDB Storage Formats
Compact
Compact
was the default format until MariaDB 10.2.1, and is suitable for general use if the Antelope file format is used. It was introduced in MySQL 5.0.In the
Compact
storage format (as in Redundant)BLOB
andTEXT
columns are partly stored in the row page. At least 767 bytes are stored in the row; values which exceed this value are are stored in dedicated pages. SinceCompact
and Redundant rows maximum size is about 8000 bytes, this limits the number ofBLOB
orTEXT
columns that can be used in a table. EachBLOB
page is 16KB, regardless the size of the data.Other columns can be stored in different pages too, if they exceed the row page's size limit.
我们实验室的 MariaDB 版本(即将部署到 Prd)。这 relevant line in bosh release。
select VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.1.26-MariaDB |
+-----------------+
1 row in set (0.00 sec)
如何修复 Swisscom Application Cloud 上的错误 ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.
(查看差异 ROW_FORMAT=DYNAMIC
):
MariaDB [Whosebug]> CREATE TABLE `dummy` (
-> `userid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
-> `providerid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
-> `provideruserid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
-> ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Query OK, 0 rows affected (0.02 sec)
MariaDB [Whosebug]> ALTER TABLE dummy ADD PRIMARY KEY (userid,providerid,provideruserid);
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [Whosebug]> show index from dummy;
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| dummy | 0 | PRIMARY | 1 | userid | A | 0 | NULL | NULL | | BTREE | | |
| dummy | 0 | PRIMARY | 2 | providerid | A | 0 | NULL | NULL | | BTREE | | |
| dummy | 0 | PRIMARY | 3 | provideruserid | A | 0 | NULL | NULL | | BTREE | | |
+-------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)
复制粘贴代码如下:
CREATE TABLE `dummy`
(
`userid` VARCHAR(255) collate utf8mb4_unicode_ci NOT NULL,
`providerid` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`provideruserid` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL
)
engine=innodb row_format=dynamic DEFAULT charset=utf8mb4 COLLATE=utf8mb4_unicode_ci;