MyISAM

MySQL rollback on the MyISAM engine

岁酱吖の 提交于 2019-12-10 17:15:34
问题 By mistake I ran the update query. This update made my table all rows values as o. Is it possible to rollback the table values? 回答1: MyISAM does not support transactions. Therefore, every individual statement runs as if it is enclosed by a transaction. You cannot roll it back. 回答2: If you have no backup, and didn't run your update in a transaction, your data is gone for good. 回答3: MYISAM dont support transaction support.. That's the reason best you should be using INNODB.. 来源: https:/

Can the MySQL system database tables be converted to InnoDB?

两盒软妹~` 提交于 2019-12-10 14:15:08
问题 I've installed MySQL 5.5 recently. I'm using InnoDB as the engine for all my databases. I noticed that the mysql database default and all of it's tables (user, db, etc...) are MyISAM . Is there any reason they cannot / should not be InnoDB ? Does anyone know if MySQL requires the mysql db to be MyISAM ? 回答1: Warning Do not convert MySQL system tables in the mysql database from MyISAM to InnoDB tables! This is an unsupported operation. If you do this, MySQL does not restart until you restore

Very slow (1 second) connections

偶尔善良 提交于 2019-12-10 09:53:32
问题 I'm running MySQL 5.6 (64-bit) on Windows 7. I'm testing a DB recently upgraded from MySQL 5.0 on 32-bit Windows 7. (I also copied my.ini, with a few changes) I'm finding that it takes a very long time to establish a connection (on the order of 1 second). As an example, I created a very simple SQL script: select 1 as n; I then ran this in a batch file 10 times which took 10 seconds to complete: mysql -h localhost -u root -D myschema 0< myscript.sql (Yes, there is no password here, this is a

How to use a full text index for exact matches?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 07:39:17
问题 I have a MySql MyISAM table with a full text index, like this: CREATE TABLE `tblsearch` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) NOT NULL, `brand` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `index_all` (`title`,`brand`) ) ENGINE=MyISAM AUTO_INCREMENT=1316109 DEFAULT CHARSET=utf8; Now I need to write a query like this to find all entries with the exact title and brand: SELECT id FROM tblsearch WHERE title=?title AND brand=?brand; It is important that the

Foreign keys vs partitioning

倾然丶 夕夏残阳落幕 提交于 2019-12-10 04:19:43
问题 Since foreign keys are not supported by partitioned mySQL databases for the moment, I would like to hear some pro's and con's for a read-heavy application that will handle around 1-400 000 rows per table. Unfortunately, I dont have enough experience yet in this area to make the conclusion by myself... Thanks a lot! References: How to handle foreign key while partitioning Partitioning mySQL tables that has foreign keys? 回答1: Well, if you need partitioning for a table as small as 400.000 rows

What's the easiest way to add an index on a live myISAM table?

梦想与她 提交于 2019-12-10 00:30:24
问题 I have a myISAM table running in production on mySQL, and by doing a few tests, we've found we can tremendously speed up a query by adding a certain compound index. So far so good. However, I am not really about the best way to add this index in a production environment without locking the table for a long time (it's got 27GBs of data, so not so much, but it does take a while). Do you have any tips? If this was a more sophisticated setup of course we'd have a live replica of all of the data

MySQL InnoDB query performance

荒凉一梦 提交于 2019-12-09 18:27:35
问题 I'm trying to optimize a simple sql query that will be run over a ton of data lot of times. This is the scenario: MySQL with InnoDB tables All fields used in where and join are Indexed. Tables have FK's. I don't need a whole cache of the query, but a cache of each table it's possible. Tables have much more reads that updates / inserts. A real query: SELECT one_field, another_field FROM big_table INNER JOIN medium_table ON ( ... ) INNER JOIN small_table ON ( ... ) WHERE week >= #number AND

InnoDB vs. MyISAM insert query time

北战南征 提交于 2019-12-09 05:25:49
问题 I have a large MySQL table (~10 Million Rows, 6.5G) Which i use for read & write. It is MyISAM, and i get a lot of locks due to MyISAM's all table lock on writes. I decided to try and move to InnoDB which is recommended for read/write tables, and it locks only specific rows on writes. After converting, I tested insert statements, and it turns out it takes ~15 times more (from 0.1 sec to 1.5 sec) in the InnoDB table than in the MyISAM table. Why is that? I haven't configured anything for

~150ms on a 2 million rows MySQL MyISAM table

混江龙づ霸主 提交于 2019-12-08 20:51:37
I'm learning about MySQL performance with a pet project consisting of ~2million rows + ~600k rows (two MyISAM tables). A range query using BETWEEN on two INT(10) indexed columns, LIMITed to 1 returned result takes about 160ms (including an INNER JOIN). I figure my configuration isn't optimised and am looking for some advice on how to either diagnose, or perhaps "common configuration". I created a gist containing both tables, the query and the contents of my.cnf. I created the b-tree index after inserting all data which was imported from a CSV file from MaxMinds open database . I tried two

mysql海量数据的优化

試著忘記壹切 提交于 2019-12-08 18:12:46
下面是一部分比较重要的建议: 1、选择正确的存储引擎 以 MySQL为例,包括有两个存储引擎 MyISAM 和 InnoDB,每个引擎都有利有弊。 MyISAM 适合于一些需要大量查询的应用,但其对于有大量写操作并不是很好。甚至你只是需要update一个字段,整个表都会被锁起来,而别的进程,就算是读进程都无法操作直到读操作完成。另外,MyISAM 对于 SELECT COUNT(*) 这类的计算是超快无比的。 InnoDB 的趋势会是一个非常复杂的存储引擎,对于一些小的应用,它会比 MyISAM 还慢。但是它支持“行锁” ,于是在写操作比较多的时候,会更优秀。并且,他还支持更多的高级应用,比如:事务。 2、优化字段的数据类型 记住一个原则,越小的列会越快。对于大多数的数据库引擎来说,硬盘操作可能是最重大的瓶颈。所以,把你的数据变得紧凑会对这种情况非常有帮助,因为这减少了对硬盘的访问。 如果一个表只会有几列罢了(比如说字典表,配置表),那么,我们就没有理由使用 INT 来做主键,使用 MEDIUMINT, SMALLINT 或是更小的 TINYINT 会更经济一些。如果你不需要记录时间,使用 DATE 要比 DATETIME 好得多。当然,你也需要留够足够的扩展空间。 3、为搜索字段添加索引 索引并不一定就是给主键或是唯一的字段。如果在你的表中,有某个字段你总要会经常用来做搜索