Hello, I’m hoping someone can point me in the right direction on this. I’ve had trouble searching because I don’t quite know what this sort of problem is officially called. We’re running MySQL 5.5.9 with four slaves and one master. I’ve been running into a problem where one or more of the slaves will choose the wrong indexes on fairly complicated queries.
For instance, with the same query, the first row on the explain will be:
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: wrsemployees
partitions: NULL
type: ref
possible_keys: PRIMARY,wrsemployees_practice_id
key: wrsemployees_practice_id
key_len: 5
ref: const
rows: 24
Extra: Using where; Using index; Using temporary; Using filesort
While on another server, it will be:
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: wrsemployeeordersnotesections
partitions: NULL
type: ALL
possible_keys: PRIMARY,wrsemployeeordersnotesections_employee_order_id,wrse mployeeordersnotesections_section_id
key: NULL
key_len: NULL
ref: NULL
rows: 3941822
Extra: Using where; Using temporary; Using filesort
Obviously, the performance on the latter is simply unacceptable.
I’ve tried analyzing the tables. I’ve tried rebuilding the indexes. A force index will solve it, but I’d like to get to the underlying issue of why some servers, with identical configurations, are returning different index paths. What is this sort of problem called? Anyone know of any reference material that can help here?