June 18, 2013

Post: Find unused indexes

ALTER TABLE `tpcc`.`order_line` DROP KEY `fkey_order_line_2`; — type:non-unique ALTER TABLE `tpcc`.`orders` DROP KEY `idx_orders`; — type:non-unique ALTER TABLE

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

… reading table with no indexes and bringing box down. You can also use this trick for ALTER TABLE which requires table rebuild. Dropping all indexes; doing ALTER and when adding them back can be a lot faster than straight ALTER TABLE. P…

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

… safe operation, unless index length increases dramatically queries which can use index can also use prefix of the new index are they ? It… not hurt any other queries a lot, right ? mysql> alter table idxitest drop key a,add key(a,b); Query OK, 0 rows… | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +—-+————-+———-+——-+—————+———+———+——+——+————-+ | 1 | SIMPLE | idxitest | index | a | PRIMARY | 4…

Post: Redundant index is not always bad

… covering index, which store all needed columns in the index, and there is no need to read row data from the table. So – we can extend index `state_id_idx` (`state_id`) by two columns: ALTER TABLE userinfo DROP KEY state_id…

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

…you find it?  (Hint: think about indexes.) … Notice in each SQL statement the clause: FORCE INDEX(`guest_language`) The tool has …t_ins`; 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.  This…

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: 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… subject of adding and dropping FT indexes, it’s entirely possible to DROP multiple FT indexes with InnoDB in the same ALTER TABLE statement, but it… time. If you try it, this is what happens: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details), ADD…

Post: pt-online-schema-change and default values

Altering new tableAltered `sbtest`.`_sbtest_new` OK. Creating triggers… Created triggers OK. Copying approximately 10000060 rows… Dropping triggers… Dropped triggers OK. Dropping new tableDropped new table…`, `k`, `c`, `pad` FROM `sbtest`.`sbtest` FORCE INDEX(`PRIMARY`) WHERE ((`id` >= …

Comment: Concatenating MyISAM files

… ‘ALTER TABLE x ADD/DROP INDEX‘, which rewrites the whole .MYD. CREATE TABLE z LIKE x; — duplicate the structure of the original table. ALTER TABLE z DROP INDEX PRIMARY, DROP INDEX my_idx, ADD INDEX

Comment: Duplicate indexes and redundant indexes

… to know how to drop duplicate index with same name. === Error === 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…