June 19, 2013

Post: Knowing what pt-online-schema-change will do

Dropping new tableDROP TABLE IF EXISTS `test`.`_t_new`; Dropped new table OK. Notice that the new, altered table created at the beginning is dropped

Post: Ultimate MySQL variable and status reference list

alter_db_upgradeblogpercona.commanual Com_alter_eventblogpercona.commanual Com_alter_functionblogpercona.commanual Com_alter_procedureblogpercona.commanual Com_alter_serverblogpercona.commanual Com_alter_tableblogpercona.commanual Com_alter

Post: Improved InnoDB fast index creation

… more detail. ALTER TABLE By temporarily dropping secondary indexes from the new table before copying the data, and then recreating them later, ALTER TABLE can take… a temporary table; ALTER TABLE and OPTIMIZE TABLE always process tables containing foreign keys as if expand_fast_index_creation is OFF to avoid dropping keys that are…

Comment: Adventures in archiving

… $table; alter table $table_01 row_format=compressed key_block_size=1; insert into $table_01 select * from $table limit 100000; #drop table if exists $table_02; create table $table_02 like $table; alter table $table_02 row_format=compressed key_block_size=2; insert into $table_02 select * from $table limit 100000; #drop table if exists $table_04; create table $table_04 like $table; alter table $table

Post: Find and remove duplicate indexes

…_4 [...] # To remove this duplicate index, execute: ALTER TABLE `test`.`t` DROP INDEX `name_3`; # Key name ends with a prefix of the clustered… shorten this duplicate clustered index, execute: ALTER TABLE `test`.`t` DROP INDEX `name`, ADD INDEX `name` (`name`); # Key age ends with a prefix of…

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

… of adding and dropping FT indexes, it’s entirely possible to DROP multiple FT indexes with InnoDB in the same ALTER TABLE statement, but…, this is what happens: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details), ADD FULLTEXT KEY (details); ERROR 1795 (HY000): InnoDB…

Post: Best kept MySQLDump Secret

ALTER TABLE. When ALTER TABLE is Performed in many cases it will Create temporary table with modified structure, copy data to that table and when drop original tabletable `C` — LOCK TABLES `C` WRITE; /*!40000 ALTER TABLE `C` DISABLE KEYS */; /*!40000 ALTER TABLE `C` ENABLE KEYS */; UNLOCK TABLES

Comment: Duplicate indexes and redundant indexes

… === alter table emp drop index fk_deptid;ERROR 1553 (HY000): Cannot drop index ‘fk_deptid’: needed in a foreign key constraint ============= Below is scenario. drop table if… | PRIMARY KEY | empid | NULL | NULL | +————–+————+—————–+—————–+————-+———————–+————————+ alter table emp drop index fk_deptid;ERROR 1553 (HY000): Cannot drop index ‘fk_deptid’: needed in a foreign key constraint…

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

… FOREIGN_KEY_CHECKS = OFF; ALTER TABLE schema.my_parent_table DROP all foreign keysALTER TABLE schema.my_parent_table DROP all indexes … OPTIMIZE TABLE schema.my_parent_table; ALTER TABLE schema.my_parent_table ADD back all indexes and foreign keys