Tag Archives: optimizer

The saddest bug of them all (SQL is dead?)

From time to time I will observe servers wasting lots of CPU when doing batch row operations. In perf top it will look like this: 8.24% mysqld [.] Arg_comparator::compare_int_unsigned() 7.17% mysqld [.] Item_cond_and::val_int() 4.37% mysqld [.] Item_field::val_int() 4.37% mysqld [.] … Continue reading

Posted in mysql | Tagged | 15 Comments

A case for FORCE INDEX

I remember various discussions in different mediums where people were building cases against use of FORCE INDEX in SQL queries. I’ll hereby suggest it using way more often, but at first I’ll start with small explanation. For ages, the concept … Continue reading

Posted in facebook, mysql | Tagged , , , | 7 Comments

on primary keys

5.1.46 has this change: Performance: While looking for the shortest index for a covering index scan, the optimizer did not consider the full row length for a clustered primary key, as in InnoDB. Secondary covering indexes will now be preferred, … Continue reading

Posted in mysql | Tagged , , | 7 Comments

MySQL 5.0 optimizer: loose scans

MySQL 5.0 among lots of visible features, introduced several neat optimizer improvements, that may give surprising performance in some queries. Loose index scan, or rather index jumping, allows fast aggregate max() or min() operations, as well as distinct row queries. … Continue reading

Posted in mysql | Tagged , | 3 Comments