June 18, 2013

Post: Redundant index is not always bad

… is 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…

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

… (0.00 sec) The obvious optimization is to extend index from column (a) to column (a,b) right which will make it faster and should not hurt any other queries a lot, right ? mysql> alter table idxitest… | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +—-+————-+———-+——-+—————+———+———+——+——+————-+ | 1 | SIMPLE | idxitest | index | a | PRIMARY | 4…

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

…the –alter statement: Altering new tableALTER TABLE `test`.`_t_new` add column (foo char(2)) Altered `test`.`_t_new` OK. If the syntax of the –alter statement…you find it?  (Hint: think about indexes.) … Notice in each SQL statement the clause: FORCE INDEX(`guest_language`) The tool has …

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… FT index by declaring a column called FTS_DOC_ID at table creation time of type BIGINT UNSIGNED NOT NULL with a unique index… adding and dropping FT indexes, it’s entirely possible to DROP multiple FT indexes with InnoDB in the same ALTER TABLE statement, but it…

Post: Converting Character Sets

… to be. Consider the following ALTER statement against the table in Approach #1: ALTER TABLE `t1` DEFAULT CHARSET=utf8, MODIFY COLUMN `c1` text CHARACTER SET… the table and target column, while leaving in place any FULLTEXT indexes. It also requires only a single ALTER statement for a given table. A…

Post: ANALYZE: MyISAM vs Innodb

table as ANALYZE did not run yet. mysql> show index from antest; +——–+————+———-+————–+————-+———–+————-+———-+——–+——+————+———+ | Table | Non_unique | Key_name | Seq_in_index | Column

Comment: Duplicate indexes and redundant indexes

… duplicate index with same name. === Error === alter table emp drop index fk_deptid;ERROR 1553 (HY000): Cannot drop index ‘…table_schema=’test’ GROUP BY table_schema, table_name, constraint_name, constraint_type, referenced_table_name, referenced_column_name ORDER BY table_schema, table_name, column

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

… conventional ALTER TABLE in MySQL I can ignore default value and it will be assigned based on the column type. For example this alter table…`, `pad`) SELECT `id`, `k`, `c`, `pad` FROM `sbtest`.`sbtest` FORCE INDEX(`PRIMARY`) WHERE ((`id` >= ?)) AND ((`id`

Post: Data compression in InnoDB for text and blob fields

… stored the first 768 bytes of variable length columns (BLOB, VARCHAR, TEXT) in the index record, and the remainder stored in overflow… CREATE TABLE or ALTER TABLE statements. In our case, we chose to re-build the table using ALTER TABLE via a null-operation like this: ALTER TABLE `t1…

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_altercolumn