嗨,我使用的是Mysql 5.0.x.
我刚刚将很多表从MyISAM改为InnoDB
使用MyISAM表大约需要1分钟来安装我们的数据库使用InnoDB大约需要15分钟来安装相同的数据库
为什么InnoDB需要这么长时间?
我该怎么做才能加快速度?
数据库安装执行以下步骤
1)删除架构
2)创建架构
3)创建表
4)创建存储过程
5)插入默认数据
6)通过存储过程插入数据
编辑:
大多数情况下,插入默认数据
有没有让InnoDB的AUTO_INCREMENT字段从0开始计数而不是1
CREATE TABLE `df_mainevent` (
`idDf_MainEvent` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`idDf_MainEvent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Run Code Online (Sandbox Code Playgroud) 使用 InnoDB 在 MySQL 5.5.9 上运行。
我创建了以下触发器:
CREATE TRIGGER TRIGGER_Products_Insert
AFTER INSERT ON Products
FOR EACH ROW
BEGIN
UPDATE Products
SET current = 0
WHERE id = new.id
AND current = 1
AND autonumber <> new.autonumber
END;
Run Code Online (Sandbox Code Playgroud)
MySQLWorkbench 在最后一行显示语法错误,执行此操作会引发以下错误
错误代码:1064。您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解第 11 行“END”附近使用的正确语法
我的错误在哪里?
有一个innodb表与~3G文件大小(我使用innodb_file_per_table = 1),刚从dump和~1.3G转储文件导入.不知道这里有多少个recods.
当我从$ table执行"select count(id)"时,我看到"27117291"(27,117,291的可读性).当我从$ table limit 100执行"select count(id)"时,我也看到"27117291"
为什么会这样?InnoDB 真的更好MyISAM吗?!
PS如果我从$ table执行"select count(id),其中id = 73010460;" 我看到"1".
MySQL 引擎:InnoDB
我有一张桌子,我需要两个字符串作为主键。这样做的原因是因为我希望 ON DUPLICATE KEY UPDATE 依赖于这两个字符串。我怎么做?提前泰。
在我的服务器上托管了两个网站(比如 abc.com 和 test.xyz.com)
我正在尝试为 test.xyz.com 和在此过程中重建数据库
1.我删除了与之相关的数据库。2.stopped mysql (/etc/init.d/mysqld stop) 3.moved ibdata1 文件 (/var/lib/mysql/ibdata1) 到 /tmp/ 4. 尝试启动 mysql
但它没有开始,在尝试使用终端连接到数据库时,我得到Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'.
我试图将 ibdata1 文件从 /tmp/ 移回 /var/lib/mysql 但已经有一个文件 ibdata1. 这是一个奇迹,但现在网站无法正常工作,因为没有数据库连接。
这两个站点现在都停止工作了。请帮忙
并且- /etc/init.d/mysqld 状态给出- mysqld (pid 31905) 正在运行...
谢谢
我有这个问题在Xaamp上打开mysql服务器
错误:MySQL意外关闭.这可能是由于端口被阻塞,缺少依赖性,不正确的权限,崩溃或其他方法的关闭.按Logs按钮查看错误日志并检查Windows事件查看器以获取更多线索如果您需要更多帮助,请在论坛和错误日志上复制并发布整个日志窗口
enter code here
2015-04-06 19:28:56 3576 [Note] Plugin 'FEDERATED' is disabled.
2015-04-06 19:28:56 2334 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-04-06 19:28:56 3576 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-04-06 19:28:56 3576 [Note] InnoDB: The InnoDB memory heap is disabled
2015-04-06 19:28:56 3576 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-04-06 19:28:56 …Run Code Online (Sandbox Code Playgroud) 我有 200 万行和 50 列的大表。
当我更新/插入大量数据时,我会删除所有索引并使用 2 个查询再次重建它们。这工作正常
但是我想为那个例子使用另一个查询:
ALTER TABLE [table_name] ENGINE = InnoDB
Run Code Online (Sandbox Code Playgroud)
正如我从这里的 mysql 指南中阅读的那样http://dev.mysql.com/doc/refman/5.6/en/optimize-table.html
InnoDB 详细信息
对于 InnoDB 表,OPTIMIZE TABLE 映射到 ALTER TABLE ... FORCE, 它重建表以更新索引统计信息并释放聚集索引中未使用的空间。当您在 InnoDB 表上运行 OPTIMIZE TABLE 时,它会显示在输出中
我还认为优化会重建索引?
OPTIMIZE TABLE [table_name]
Run Code Online (Sandbox Code Playgroud)
你有什么建议,我的表有超过 200 万行和 50 列
根据慢查询日志,以下查询(和类似查询)偶尔需要大约 2s 执行:
INSERT INTO incoming_gprs_data (data,type) VALUES ('3782379837891273|890128398120983891823881abcabc','GT100');
Run Code Online (Sandbox Code Playgroud)
表结构:
CREATE TABLE `incoming_gprs_data` (
`id` int(200) NOT NULL AUTO_INCREMENT,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`data` text NOT NULL,
`type` char(10) NOT NULL,
`test_udp_id` int(20) NOT NULL,
`parse_result` text NOT NULL,
`completed` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `completed` (`completed`)
) ENGINE=InnoDB AUTO_INCREMENT=5478246 DEFAULT CHARSET=latin1
Run Code Online (Sandbox Code Playgroud)
与此表相关的活动:
SELECT * FROM incoming_gprs_data WHERE completed = 0,处理它们并更新completed = 1completed …我在MySQL日志中看到以下错误:
[Warning] InnoDB: Cannot add field `wd_field_ft_95_240` in table `tmp`.`#sql_1_0` because after adding it, the row size is 8155 which is greater than maximum allowed size (8126) for a record on index leaf page.
这个tmp数据库是某种内部MySQL结构吗?这是我需要关心的事吗?
innodb ×10
mysql ×10
bulk-load ×1
bulkinsert ×1
database ×1
indexing ×1
myisam ×1
sql ×1
temp-tables ×1
triggers ×1