June 19, 2013

Post: Implementing SchemaSpy in your MySQL environment

AUTO_INCREMENT, PRIMARY KEY (`parent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 CREATE TABLE `child_A` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENTbe made to display if you tag the Implied relationships box, but this generally only works if you have used the

Post: Replication in MySQL 5.6: GTIDs benefits and limitations - Part 1

the same value for gtid_mode, so you should restart them at the same time, which is best done by making the…on the master: mysql> create table test.t (id int not null auto_increment primary …set to ON. Could it be interesting to run file-based replication when gtid_mode is ON? I can’t think of any use

Post: Understanding the maximum number of columns in a MySQL table

to enter in all the data! You could also have things like NEXT_NUMBER fields (what we know today as auto_incrementvaluesto be the maximum number of columns you can create. If you try setting the storage engine to InnoDB however, you will get an error message! The

Post: AUTO_INCREMENT and MERGE TABLES

auto_increment value to be reused too. Can you use AUTO_INCREMENT clause in CREATE TABLE to get different auto_increment values ? I guess not: mysql> alter table am auto_increment

Post: Sharing an auto_increment value across multiple MySQL tables

auto_increment) engine=innodb; # each insert does one operations to get the value: INSERT INTO option1 VALUES (NULL); # $connection->insert_id(); Option #2: UseThe problem is that to be like most applications, we can’t really tell until a little concurrency is applied. Using only the

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

set (0.00 sec) Yep, it’s actually THE LAST ROW, the one where the id is equal to the auto-increment max value, which is theto this: just change the AUTO-INCREMENT column to use a BIGINT, and problem solved. As it turns out, this is documented behavior; the

Post: Stored Function to generate Sequences

to “inject” the value to be returned next time this function is called. Sometimes people wonder why you would like to use sequences instead of MySQL auto_increment

Post: A workaround for the performance problems of TEMPTABLE views

… ) ENGINE=InnoDB AUTO_INCREMENT=2949071 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) If we define a view which uses no …to this connection. When the table is inserted too (see below) the connection_id() function will be used to generate the value for the connection_id column. Also notice the

Post: How (not) to find unused indexes

be removed.  This method is flawed – here’s the first reason why: CREATE TABLE `sales` ( `id` int(11) NOT NULL AUTO_INCREMENTthe numbers “20-30%” as the minimum amount of rows you have to filter down to for an index to be useful

Post: Replication of the NOW() function (also, time travel)

be set by the MySQL client. MySQL adds special events in the binary log which set the TIMESTAMP and INSERT_ID (which is used for AUTO_INCREMENT replication) to the correct values to ensure that statements replicate properly. Here is the SQL to produce the above output: SET