… query in a suboptimal form. Q: Doesn’t the primary key solution for random selection only work when the IDs for movies are… “gap” will be picked more frequently. Nearly every solution for randomly choosing rows involves some compromise, either of performance, or of… table, and making lookups to the `kind_types` table by primary key, the result was a query that took half the time…
Post: Benchmarking Percona Server TokuDB vs InnoDB
…, $K) ON DUPLICATE KEY UPDATE k=VALUES(k)+k; COMMIT; So this workload produces SEQUENTIAL inserts into Primary Key, that this is quite suitable for InnoDB, and in it we have random inserts into SECONDARY KEYS (k), which…, $ID/1000, $K) ON DUPLICATE KEY UPDATE k=VALUES(k)+k; COMMIT; That is, our PRIMARY KEY is not sequential anymore, which is…
Post: Long PRIMARY KEY for Innodb tables
… other key will refer to the rows by primary key. I also recommended to use sequential primary keys so you do not end up having random primary key BTREE updates which can be very expensive. Today I would like to share practical example when you may use long primary key…
Post: Multi Range Read (MRR) in MySQL 5.6 and MariaDB 5.5
… rows that match the condition ‘key_column=x’. You can see that there are a lot of random primary key lookups made. With MRR, then steps above are changed to the following: SELECT key_column, pk_column FROM tbl WHERE key… key tuples by pk_column, we have converted a lot of point primary key lookups to one or more range primary key lookup. Thereby, converting Random…
Post: To pack or not to pack - MyISAM Key compression
… over to get previous value Random single row lookup by index (ie joins) will also suffer as key block needs to be… how integer primary key is handled. I can’t see the index size difference between DEFAULT and 1 values for such key. However… NULL default ”, KEY `c` (`c`), KEY `id` (`id`) ) ENGINE=MyISAM Index size: PACK_KEYS=DEFAULT – 1550K PACK_KEYS=1 – 1453K PACK_KEYS=0 – 8176K As…
Post: Using CHAR keys for joins, how much is the overhead ?
… unlike other benchmarks I decided to do Join not on primary key and have query to read data for both tables. If…: 1 select_type: SIMPLE table: t1 type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 262144 Extra: *************************** 2. row… as MyISAM uses key compression for varchar columns so random key lookups become significantly slower. I tried to set pack_keys=0 which typically…
Post: A case for MariaDB's Hash Joins
… NULL, PRIMARY KEY (`l_orderkey`,`l_linenumber`), KEY `i_l_shipdate` (`l_shipDATE`), KEY `i_l_suppkey_partkey` (`l_partkey`,`l_suppkey`), KEY `i_l… NULL, `o_comment` varchar(79) DEFAULT NULL, PRIMARY KEY (`o_orderkey`), KEY `i_o_orderdate` (`o_orderDATE`), KEY `i_o_custkey` (`o_custkey`) ) ENGINE… key o_orderdate which results in random scans of the PK to fetch the columns that are not part of the secondary key…
Post: To UUID or not to UUID ?
… an article comparing UUID and auto_increment primary keys, basically advertising to use UUID instead of primary keys. I wanted to clarify this a… applies to Innodb tables aspect of primary key selection – you often can gain a lot by selecting primary key which provides data clustering which… rather lookup by primary key speed. Lookup speed can be similar or can vary a lot. If we have completely random lookups it…
Post: Heikki Tuuri Innodb answers - Part I
… wrong. Q10: When Innodb decides to schedule sequential read-ahead, random read ahead ? HT: InnoDB schedules a sequential read-ahead when… foreign key not reference an entire primary key or unique constraint (something that is mandatory in every other RDBMS that suppors foreign key constraints…
Post: Statistics of InnoDB tables and indexes available in xtrabackup
…’, PRIMARY KEY (`link_id`), UNIQUE KEY `domain_id_2` (`domain_id`,`link_id`), KEY `domain_id` (`domain_id`,`from_site_id`,`message_published`), KEY `revert… insert into the primary key in order which makes things very predictable, but the inserts into the secondary key index are random – which leads…

