
Hi, with OR on a non-indexed column (first_name) a full table scan is done. You have to consider those double indexes as a concatenated index of last_name.first_name, which means that mysql can only take advantage if you have conditions in the order of last_name AND first_name (as mysql can concat this result), but not with last_name OR first_name (there is no way to concat last_name with first_name in a way to take advantage of the index. It might be used only for last_name, but still a full table scan is performen for first_name :/). Does this make a bit sense? On Thu, 15 Jul 2010, Michiel Van Bel wrote:
okay, I'm a bit confused: http://dev.mysql.com/doc/refman/4.1/en/multiple-column-indexes.html
You see 2 examples at the bottom, where the name index is NOT used. I understand why the index is not used in the first example, but why is it not used for the "last_name" part in the query of the second example?
I think I need to revise my knowledge on indexing a bit :-/
-- ====================================================================== Kenny Billiau Bioinformatics Group / GoFORSYS Scientific Programmer +49 331 567 8626 billiau@mpimp-golm.mpg.de Max Planck Institute for Molecular Plant Physiology Am Mühlenberg 1, 14476 Potsdam-Golm, Germany http://bioinformatics.mpimp-golm.mpg.de http://www.goforsys.de ======================================================================