June 19, 2013

Post: Migrating between MySQL schemas with Percona Xtrabackup

….sql Create the new target database:  mysqladmin create orig_old Load the schema into the target database:  mysql orig_old < /tmp/orig...: mysql -N -B <<'EOF' > discard-ddl.sql SELECT CONCAT(‘ALTER TABLE `’, table_name, ‘` DISCARD TABLESPACE;’) AS _ddl FROM INFORMATION_SCHEMA.TABLES WHERE…

Post: Innodb vs MySQL index counts

… strange errors in their mysqld.err log: [ERROR] Table database_name/table_name contains 8 indexes inside InnoDB, which is different from the… extra index in Innodb could be removed by doing: ALTER TABLE table_name ENGINE=Innodb; This, of course, rebuilds the whole table… not the greatest thing to do on a live production database master if you can help it. Another solution might be…

Comment: Dangerous command

… things that live in a database are in rather scattered locations — in a directory named after the database, referenced from a .frm file… was to help with upgrades that involve re-encoding the database name on disk. that functionality lives on as ALTER DATABASE … UPGRADE DATA DIRECTORY NAME.

Post: Database problems in MySQL/PHP Applications

… $dbcon->query(“Select email from user where name=%s”,$name) – wrapper will detect query is being… important benefits – your data becomes managable, your ALTER TABLE or OPTIMIZE TABLE now locks small… will work quite fast with almost empty database. With database growth it will however start to crawl….

Post: Using MMM to ALTER huge tables

… your application does not have inserts without columns named (bad e.g. “INSERT INTO table VALUES (id… to db1 at this stage. If you’re altering gigabyte size tables, this step may take some … slower or faster method depending on your overall database size, scope of changes, and few other variables …

Post: MySQL Backup tools used by Percona Remote DBA for MySQL

… how we dump schemas: loop through each DB write out ALTER DATABASE DEFAULT CHARACTER SET to the schema file, putting in… are due to problems with “FLUSH TABLE WITH READ LOCK”. Namely when a select is blocking the flush from completing and…

Post: Find and remove duplicate indexes

…-key-checker –database=test # ######################################################################## # test.t # ######################################################################## # name_2 is a left-prefix of name_4 [...] # To remove this duplicate index, execute: ALTER TABLE `test…

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….commanual skip_name_resolveblogpercona.commanual …

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

… are a lot of “new” InnoDB tablespace files in our database directory: -rw-rw—-. 1 mysql mysql 8632 Feb 20 15…, the following warning is generated: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details); Query OK, 0 rows affected… it, this is what happens: mysql> alter table dir_test_innodb ADD FULLTEXT KEY (full_name, details), ADD FULLTEXT KEY (details); ERROR…

Post: Find unused indexes

…To generate some load on the database I’m going to use…_INDEX_STATS.INDEX_NAME‘GEN_CLUST_INDEX’; +————+——————-+ | TABLE_NAME | INDEX_NAME | +————+——————-+ | stock | fkey_stock_2 |…_order_line_2`; — type:non-unique ALTER TABLE `tpcc`.`orders` DROP KEY `idx_…