首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Barracuda文件格式创建表

如何使用Barracuda文件格式创建表
EN

Stack Overflow用户
提问于 2017-05-13 16:04:45
回答 2查看 4.7K关注 0票数 0

因为我需要几个中间文本字段,所以我需要梭鱼文件格式。有很多关于如何将现存的羚羊表转换成梭鱼的文章和视频,但是没有关于如何使用梭鱼创建一个新的表。用MariaDB很容易做到这一点吗?如果可能的话,我想用码头集装箱。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-05-13 17:39:04

尝试:

代码语言:javascript
复制
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION()       |
+-----------------+
| 10.1.23-MariaDB |
+-----------------+
1 row in set (0.00 sec)

MariaDB [_]> SHOW VARIABLES LIKE 'innodb_file_format';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| innodb_file_format | Antelope |
+--------------------+----------+
1 row in set (0.01 sec)

MariaDB [_]> CREATE TABLE `barracuda_table` (`col` MEDIUMTEXT) ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected, 2 warnings (0.00 sec)

MariaDB [_]> SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level   | Code | Message                                                            |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. |
| Warning | 1478 | InnoDB: assuming ROW_FORMAT=COMPACT.                               |
+---------+------+--------------------------------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [_]> SELECT ROW_FORMAT
    -> FROM `information_schema`.`tables`
    -> WHERE `TABLE_SCHEMA` = DATABASE() AND
    ->       `TABLE_NAME` = 'barracuda_table';
+------------+
| ROW_FORMAT |
+------------+
| Compact    |
+------------+
1 row in set (0.00 sec)

MariaDB [_]> DROP TABLE `barracuda_table`;
Query OK, 0 rows affected (0.00 sec)

MariaDB [_]> SET @@GLOBAL.innodb_file_format = 'Barracuda';
Query OK, 0 rows affected (0.00 sec)

MariaDB [_]> SHOW VARIABLES LIKE 'innodb_file_format';
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| innodb_file_format | Barracuda |
+--------------------+-----------+
1 row in set (0.00 sec)

MariaDB [_]> CREATE TABLE `barracuda_table` (`col` MEDIUMTEXT) ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.00 sec)

MariaDB [_]> SELECT ROW_FORMAT
    -> FROM `information_schema`.`tables`
    -> WHERE `TABLE_SCHEMA` = DATABASE() AND
    ->       `TABLE_NAME` = 'barracuda_table';
+------------+
| ROW_FORMAT |
+------------+
| Dynamic    |
+------------+
1 row in set (0.00 sec)

MariaDB [_]> SELECT `NAME`, `FILE_FORMAT`, `ROW_FORMAT`
    -> FROM `information_schema`.`INNODB_SYS_TABLES`
    -> WHERE `NAME` = '_/barracuda_table';
+-------------------+-------------+------------+
| NAME              | FILE_FORMAT | ROW_FORMAT |
+-------------------+-------------+------------+
| _/barracuda_table | Barracuda   | Dynamic    |
+-------------------+-------------+------------+
1 row in set (0.00 sec)

XtraDB/InnoDB存储格式

票数 1
EN

Stack Overflow用户

发布于 2017-05-15 00:53:02

它在5.6中很混乱(MariaDB 10.0和10.1):

代码语言:javascript
复制
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_large_prefix=1;     -- optional (if you also need wide indexes)
ALTER TABLE tbl ROW_FORMAT=DYNAMIC;

它可能在5.7 (MariaDB 10.2)中被正确地默认。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43955210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档