I've had something funny happen to me thismorning: I did an EXPLAIN -
it couldn't find an index that was there. Then I did a DESCRIBE. Then
I did an EXPLAIN again, and it *could* find the index.
Is this expected behaviour? (4.0.22-standard)
1st EXPLAIN:
+-------+------+--------------------+-------------+---------+-------+---------+----------------------------------------------+
| table | type | possible_keys | key | key_len | ref |
rows | Extra |
+-------+------+--------------------+-------------+---------+-------+---------+----------------------------------------------+
| c | ref | PRIMARY,status | status | 1 | const |
44394 | Using where; Using temporary; Using filesort |
| s | ref | customer_id,status | customer_id | 8 | c.id |
1 | Using where |
| crl | ALL | NULL | NULL | NULL | NULL |
1668865 | |
+-------+------+--------------------+-------------+---------+-------+---------+----------------------------------------------+
then I did a DESC on "crl".
And a SHOW CREATE TABLE on "crl".
Then I did another EXPLAIN on the query, and got (note: now there are
possible_keys on "crl"):
+-------+------+------------------------+------------------------+---------+------------+-------+----------------------------------------------+
| table | type | possible_keys | key |
key_len | ref | rows | Extra
|
+-------+------+------------------------+------------------------+---------+------------+-------+----------------------------------------------+
| c | ref | PRIMARY,status | status |
1 | const | 44394 | Using where; Using temporary; Using
filesort |
| s | ref | customer_id,status | customer_id |
8 | c.id | 1 | Using where
|
| crl | ref | idx_customer_id_status | idx_customer_id_status |
11 | c.id,const | 17 |
|
+-------+------+------------------------+------------------------+---------+------------+-------+----------------------------------------------+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]