June 18, 2013

Post: The small improvements of MySQL 5.6: Duplicate Index Detection

… for duplicate keys, but not redundant ones. What is the difference? Let’s see an example. If we execute: mysql> ALTER TABLE test ADD INDEX… mysqlindexcheck, similar to pt-duplicate-key-checker, but it does not detect all cases. For example: mysql> alter table test add index redundant (col2, id…

Post: ALTER TABLE: Creating Index by Sort and Buffer Pool Size

…()),’-',sha1(rand()),’-',sha1(rand()),’-',sha1(rand())); and added key on column C: alter table sbtest add key c(c); The box I’m using for…. I used 10mil row table which would look as following in terms of data and index size: mysql> show table status like “sbtest…: If you’re having large tables and need to run ALTER TABLE which rebuilds the table or OPTIMIZE TABLE do not forget to enable expand…

Post: Should you name indexes while doing ALTER TABLE ?

… warning: mysql> alter table t1 add key(i); Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table t1 add key(i); Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table t1 add key(i); Query…

Post: Hacking to make ALTER TABLE online for certain changes

table. No matter if it’s InnoDB or MyISAM, you’d usually ALTER TABLE `huge_tablemysql> SHOW CREATE TABLE `huge_table`\G *************************** 1. row *************************** Table: huge_table Create Table: CREATE TABLE `huge_table` ( `id` int(6) NOT NULL, `text` text NOT NULL, PRIMARY KEY

Post: Using innodb_sys_tables and innodb_sys_indexes

…simple ALTER TABLE such as: “alter table sbtest add z int not null;” which I expected would create table with primary key …… and indeed it does. mysql> select * from innodb_sys_tables where table_id=18; +———-+——–+————–+——+——–+——-+ | TABLE_ID | SCHEMA | NAME | FLAG …

Post: Hijacking Innodb Foreign Keys

… (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id… proper type and indexed): mysql> set foreign_key_checks=0; Query OK, 0 rows affected (0.00 sec) mysql> alter table parent rename parentx; Query…

Post: MySQL Upgrade Webinar Questions Followup

ALTER TABLE statements? Yes. This is exactly how it is done in many cases. There is really no gain in dumping table…. Q: What are the key concerns upgrading MySQL 4.1 to MySQL 5.5? This is jumping … packages (most typically used in production) which adds the difference compared to your production use….

Post: Find and remove duplicate indexes

MySQL won’t complain. Let’s see this example: mysql> alter table t add index(name); mysql> alter table t add index(name); mysql> alter table t add index(name); mysql> show create table t\G [...] KEY `name` (`name`), KEY `name_2` (`name`), KEY `name_3` (`name`) [...] MySQL

Post: InnoDB Full-text Search in MySQL 5.6 (part 1)

… I create one, the following warning is generated: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details); Query OK, 0 rows affected… try it, this is what happens: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details), ADD FULLTEXT KEY (details); ERROR 1795 (HY000): InnoDB presently…