June 19, 2013

Post: Getting MySQL to use full key length

…). I think optimizer should be fixed to always expand and use “range” lookup at least for simple ranges. Even … is traversed anyway. So how do you force MySQL optimizer to use full length in this case ? ANALYZE …A) and (A,B) for query A=Const and B>Const we can see MySQL selecting (A) index instead of…

Post: Join Optimizations in MySQL 5.6 and MariaDB 5.5

… index lookups to one or more index range lookups. This means MySQL can employ many other optimizations like for example if columns other… made on MySQL 5.6 config: optimizer_switch=’index_condition_pushdown=off’ optimizer_switch=’mrr=on’ optimizer_switch=’mrr_cost_based=off’ optimizer_switch=’batched…_size set to 6M, the query time for MySQL 5.6 becomes approximately equal to that of MySQL 5.5. MariaDB 5.5…

Post: Joining on range? Wrong!

… around since the very beginning of MySQL, however unless you carefully analyse and profile your queries, it might easily go unnoticed. I… the date range. A very inefficient approach! MySQL was unable to optimize those simple conditions to match both product id and date range by… always comes down to removing range condition from join one way or another. For our example query this could mean introducing additional…

Post: Beware of MySQL Data Truncation

…article_id)); Query OK, 0 rows affected (0.11 sec) mysql> insert into article_comment values(4300000000,1); Query OK, … of range value adjusted for column ‘article_id’ at row 1 | +———+——+————————————————————–+ 1 row in set (0.00 sec) MySQL optimizer

Post: How expensive is a WHERE clause in MySQL?

… much overhead does a trivial WHERE clause add to a MySQL query?  To find out, I set my InnoDB buffer pool… need SQL_NO_CACHE on this query?) The average execution time for this query is 7.96, ranging from 7.65 to 8… to make your queries faster — you usually can’t optimize the WHERE clause itself, only the way that the MySQL optimizer chooses to apply…

Comment: MySQL Server Memory Usage

… ‘Com_lock_tables’, ’102′ ‘Com_optimize‘, ’0′ ‘Com_preload_keys’, ’0′… ’0′ ‘Select_full_range_join’, ’0′ ‘Select_range‘, ’5683551′ ‘Select_range_check’, ’0′…mysql.sock pid-file=/var/run/mysql/mysql.pid datadir=/db/disk2/mysql/data log-bin=/var/log/mysql/log log-slow-queries=/var/log/mysql/slow-queries

Post: ORDER BY ... LIMIT Performance Optimization

…index – in this case index range scan will be started and query execution stopped as soon as …indexed) Force index if needed In some cases MySQL Optimizer may prefer to use different index, which has…in slow query log as query which does not use indexes, even if it is quite fast: mysql> explain select…

Post: MySQL 6.0 vs 5.1 in TPC-H queries

optimizer, which should affect execution plan of TPC-H queries. In reality only two queriesqueries that execute slower in new MySQL 6.0 version. Query… | 1 | SIMPLE | lineitem | range

Post: Possible optimization for sort_merge and UNION ORDER BY LIMIT

… allow MySQL to still use second portion of the index for the order by. Ranges as well as IN lists make this optimization impossible, not even speaking about index merge optimization. Lets look at… used for optimizing ORDER BY with IN. This original query (in memory data) takes 1sec. Let’s see how classic pre MySQL 5…

Page: Presentations

Query Optimization Web Tuesday , Zurich, Switzerland, November 2007 Presentation covers some basic rules of queries optimization for MySQL including application based tuning such as avoiding queries