June 18, 2013

Post: Implementing SchemaSpy in your MySQL environment

…=latin1 CREATE TABLE `child_A` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE…=latin1 CREATE TABLE `child_B` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY…

Post: How to recover table structure from InnoDB dictionary

… NULL, `N_FIELDS` int(10) unsigned DEFAULT NULL, `TYPE` int(10) unsigned DEFAULT NULL, `SPACE` int(10) unsigned DEFAULT NULL, `PAGE_NO` int(10) unsigned DEFAULT NULL, PRIMARY…) DEFAULT NULL, `MTYPE` int(10) unsigned DEFAULT NULL, `PRTYPE` int(10) unsigned DEFAULT NULL, `LEN` int(10) unsigned DEFAULT NULL, `PREC` int(10) unsigned DEFAULT NULL, PRIMARY KEY…

Post: Benchmarking Percona Server TokuDB vs InnoDB

… looks like: CREATE TABLE sbtest$I ( id BIGINT UNSIGNED NOT NULL, k INTEGER UNSIGNED DEFAULT ’0′ NOT NULL, c CHAR(120) DEFAULT…` ( `hid` int(10) unsigned NOT NULL DEFAULT ’0′, `mid` int(10) unsigned NOT NULL DEFAULT ’0′, `id` bigint(20) unsigned NOT NULL, `k` int(10) unsigned NOT…

Post: Integers in PHP, running with scissors, and portability

… ) { // on x64, we can just use int if ( ((int)4294967296)!=0 ) return (((int)$hi)<<32) + ((int)$lo); // workaround signed/unsigned braindamage on x32 $hi = sprintf… C/C++ snippet look like: typedef unsigned long long myuint64; // just for brevity unsigned int a = 0xffffffffULL; unsigned int b = 0xffffffffULL; myuint64 c = (myuint64(a…

Post: Helgrinding MySQL with InnoDB for Synchronisation Errors, Fun and Profit

…_select(THD*, Item***, TABLE_LIST*, unsigned int, List&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st…_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:2791) ==9090==    by 0×788973: sp_instr_stmt::execute(THD*, unsigned int*) (sp_head…

Comment: How well does your table fits in innodb buffer pool ?

…_select(THD*, Item***, TABLE_LIST*, unsigned int, List&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select…_parse(THD*, char*, unsigned int, char const**)+0x2c1) [0x7fd959b606e1] /usr/sbin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x5b1) [0x7fd959b60ca1] /usr…

Post: Enum Fields VS Varchar VS Int + Joined table: What is Faster?

…: 1) Table with ENUM: CREATE TABLE cities_enum ( id int(10) unsigned NOT NULL auto_increment, state enum(‘Alabama’,'Alaska’,'Arizona’,'Arkansas…; 2) Table with VARCHAR: CREATE TABLE cities_varchar ( id int(10) unsigned NOT NULL auto_increment, state varchar(50) NOT NULL, city…; 3) Table with INT: CREATE TABLE cities_join ( id int(10) unsigned NOT NULL auto_increment, state_id tinyint(3) unsigned NOT NULL, city…

Comment: Hacking to make ALTER TABLE online for certain changes

… this though instead changed a signed INT to an unsigned INT. MySQL uses twos complement for negative ints and knowing that a table doesn’t contain any negative values, it was possible to just tell MySQL to use unsigned ints… TABLE Citytmp LIKE City; mysql> ALTER TABLE Citytmp MODIFY ID INT UNSIGNED NOT NULL AUTO_INCREMENT; # cp /var/lib/mysql/world/Citytmp…

Post: Beware of MySQL Data Truncation

… a system storing articles and you use article_id as unsigned int. As the time goes and you see you may get…_id to bigint unsigned but forget linked tables. mysql> create table article_comment(article_id int unsigned not null, comment_id int unsigned not null…

Post: Can you Trust CHECK TABLE ?

… replaced .frm file for the table from different one changing INT to UNSIGNED INT to see what effect it will give – as you…, which does store values larger than max signed int but which sorts them as unsigned ints. Quite fun. I hope the task of…