I have a question about index usage. I've got a query that's showing up in the -slow
log (it's taking less than long_query_time seconds, but I've got --log-long-format
set), indicating that it's not using an index, and I don't understand why.
Given two tables:
CREATE TABLE c1 (id INT(8) NOT NULL UNIQUE, txt VARCHAR (10) NOT NULL UNIQUE, PRIMARY
KEY (id) );
CREATE TABLE c2 (id INT(8) NOT NULL UNIQUE, PRIMARY KEY (id) );
CREATE UNIQUE INDEX c1_txt_idx ON c1 (txt);
And the query:
SELECT * FROM c1, c2 WHERE c1.id=c2.id ORDER BY c1.txt;
Now, the question:
Why is this query showing up in the -slow log?
Thanks,
Mark Chalkley
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php