Filter-fodder: mysql, query
Ah. Sorry about that.
Given a query:
"SELECT academic_institutions.name,
academic_institutions.town, countries.abbrv,
inst_types.name, academic_institutions.acinstid
FROM academic_institutions, inst_types
LEFT JOIN countries ON academic_institutions.cykey = countries.cyid
WHERE academic_institutions.itkey = inst_types.itid
ORDER BY academic_institutions.name DESC
EXPLAIN SELECT produces:
+-------------------------+--------+------------------+-----------+
| table | type | possible_keys | key |
+-------------------------+--------+------------------+------------+
| academic_institutions | ALL | NULL | NULL |
| inst_types | eq_ref | PRIMARY | PRIMARY |
| countries | eq_ref | PRIMARY | PRIMARY |
+------------------------+---------+--------------------+---------+
+---------+--------------------------------+------+---------------+
| key_len | ref | rows | Extra |
+---------+--------------------------------+------+---------------+
| NULL | NULL | 6682 | Using filesort |
| 2 | academic_institutions.itkey | 1 | |
| 2 | academic_institutions.cykey | 1 | |
+---------+-----------------------------+------+------------------+
Is there any way of creating a sorted index on
academic_institutions.name DESC
in order to avoid using filesort?
And some of the more complex queries have "Using temporary" as well as "Using
filesort".
Donna
Maybe none of understand what your question means?
I know I don't.
>
>Hi,
>
>Is this a very hard question or an absurdly simple one? I posted it days ago,
>and no-one has responded! Please can someone help?
>
>> How can I avoid "Using temporary, "Using filesort"
>> when creating indices when my selects MUST be ordered?
>
>Donna
---------------------------------------------------------------------
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