June 20, 2013

Post: Hijacking Innodb Foreign Keys

… make it happen: CREATE TABLE `parent` ( `parent_id` int(11) NOT NULL, `v` varchar(10) DEFAULT NULL, PRIMARY KEY (`parent_id`) ) ENGINE…) mysql> show create table child \G *************************** 1. row *************************** Table: child Create Table: CREATE TABLE `child` ( `parent_id` int(11) NOT NULL, `v` varchar

Post: Beware the Innodb Table Monitor

… itself dumps the contents of the Data dictionary to the mysql error log, which looks something like this: =========================================== 090420 12:09… COLUMNS: ID: DATA_VARCHAR DATA_ENGLISH len 0; FOR_NAME: DATA_VARCHAR DATA_ENGLISH len 0; REF_NAME: DATA_VARCHAR DATA_ENGLISH len 0; N_COLS: DATA_INT len 4; DB…

Post: High-Performance Click Analysis with MySQL

…-0019b984eacd” and is it stored in a VARCHAR(36)?  When tables get big, every …int unsigned not null, clicks int unsigned not null, impressions int unsigned not null, blue_clicks int unsigned not null, blue_impressions int… by either using MySQL 5.1′s row-based replication, or in MySQL 5.0 and …

Post: Recovering from a bad UPDATE statement

… table without a WHERE clause?  Did you know that in MySQL 5.5 that sometimes you can recover from a bad… ! Imagine this scenario: CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` varchar(10) NOT NULL, PRIMARY KEY (`c1`) ) ENGINE…=ROW — MIXED doesn’t help as in my testing as MySQL chooses to binlog UPDATEs in STATEMENT format when in MIXED…

Post: Dynamic row format for MEMORY tables

…. In 2008 Igor Chernyshev of eBay implemented true-VARCHAR support for MEMORY tables for MySQL 5.0. Although this patch did not… be the following: CREATE TABLE sbtest (id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, c VARCHAR(4096) NOT NULL DEFAULT ”, PRIMARY KEY… row format could be used instead: for schemas containing large VARCHARs, BLOB, TEXT. Unfortunately, enabling this feature is not trivial, but…

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

VARCHAR(255) “title” and “details” with a TEXT “body”. CREATE TABLE `dir_test_innodb` ( `id` int(10) unsigned NOT NULL, `full_name` varchar….ibd -rw-rw—-. 1 mysql mysql 98304 Feb 20 16:09 FTS_00000000000000ad_STOPWORDS.ibd -rw-rw—-. 1 mysql mysql 98304 Feb 20 15….ibd -rw-rw—-. 1 mysql mysql 98304 Feb 20 15:54 FTS_0000000000000114_STOPWORDS.ibd -rw-rw—-. 1 mysql mysql 8618 Feb 20 16…

Post: Percona XtraDB Cluster: Multi-node writing and Unexpected deadlocks

… insert some data: node2 mysql> create table autoinc ( i int unsigned not null auto_increment primary key, j varchar(32) ); Query OK, 0 rows affected (0.02 sec) node2 mysql> show… TABLE `autoinc` ( `i` int(10) unsigned NOT NULL AUTO_INCREMENT, `j` varchar(32) DEFAULT NULL, PRIMARY KEY (`i`) node2 mysql> insert into autoinc…

Post: Concatenating MyISAM files

… able to concatenate these files. Let’s see. mysql> create table test_concat(id int unsigned not null, primary key (id)) engine… added varchar and deleted rows to the mix: mysql> truncate table test_concat; Query OK, 0 rows affected (0.00 sec) mysql> truncate table test_concat_part; Query OK, 0 rows affected (0.01 sec) mysql> alter table test_concat add data varchar(10…

Post: MySQL 6.0 vs 5.1 in TPC-H queries

…TPC-H benchmarks, particularly comparing MySQL 6.0.4-alpha with 5.1. MySQL 6.0 is interesting …orderkey` int(11) NOT NULL, `l_partkey` int(11) NOT NULL, `l_suppkey` int(11) NOT NULL, `l_linenumber` int(11… `l_shipinstruct` char(25) NOT NULL, `l_comment` varchar(44) NOT NULL, `l_shipmode` char(10) NOT …

Post: Edge-case behavior of INSERT...ODKU

… the situation: CREATE TABLE update_test ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, username VARCHAR(20) NOT NULL, host_id TINYINT UNSIGNED… always going to be considered as being defined first. So, MySQL checks our INSERT, sees that the next auto-inc value…. Do the math. The maximum value for an auto-increment INT UNSIGNED is 4294967295. Divide that by 1500 qps and then…