June 19, 2013

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

mysql> SHOW CREATE TABLE test\G *************************** 1. row *************************** Table: test Create Table: CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT

Post: AUTO_INCREMENT and MERGE TABLES

… cause auto_increment value to be reused too. Can you use AUTO_INCREMENT clause in CREATE TABLE to get different auto_increment values ? I guess not: mysql> alter table am auto_increment… MyISAM tables works: mysql> alter table a1 auto_increment=100; Query OK, 1 row affected (0.00 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> alter table a2 auto_increment=100…

Post: Avoiding auto-increment holes on InnoDB with INSERT IGNORE

… you using InnoDB tables on MySQL version 5.1.22 or newer? If so, you probably have gaps in your auto-increment columns. A…) Now check the auto_increment counter: show create table foo\G *************************** 1. row *************************** Table: foo Create Table: CREATE TABLE `foo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` int… a customer. So, if this saves you from doing an ALTER TABLE to change the auto incremental column size, then send him a beer ;)

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

… row table which would look as following in terms of data and index size: mysql> show table …: 0 Index_length: 1460322304 Data_free: 7340032 Auto_increment: 10000001 Create_time: 2012-06-27 13…re having large tables and need to run ALTER TABLE which rebuilds the table or OPTIMIZE TABLE do not forget…

Post: Hacking to make ALTER TABLE online for certain changes

…PK auto_incremental from the table. As a rule of thumb, this usually involves altering huge InnoDB tables and huge tables take…auto_increment, (2) flush tables with read lock, (3) swap .frm files while keeping mysql suspended and (4) unlock the tables afterwards: — 1. mysql> CREATE TABLE `huge_table

Post: Ultimate MySQL variable and status reference list

MySQL manual, especially the option and variable reference tableauto_increment_incrementblogpercona.commanual auto_increment

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

table that has never had a full-text index on it, and then I create one, the following warning is generated: mysql> alter table…, you’ll get an error: mysql> CREATE TABLE dir_test_innodb4 (fts_doc_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY); ERROR 1166… a time. If you try it, this is what happens: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details), ADD…

Post: Thinking about running OPTIMIZE on your Innodb Table ? Stop!

mysql> alter table a drop key c; Query OK, 0 rows affected (0.46 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> optimize table a; +——–+———-+———-+——————————————————————-+ | Table

Post: Extending Index for Innodb tables can hurt performance in a surprising way

… NULL AUTO_INCREMENT, `a` int(11) NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=6029313 DEFAULT CHARSET=latin1 mysql> select count(*) from idxitest where a=5 and… and should not hurt any other queries a lot, right ? mysql> alter table idxitest drop key a,add key(a,b); Query OK…