I have managed to eliminate this from all but one of my queries by the use of indexes, however I am stuck on the following very simple query:
select distinct column_name from table;
Does anyone know of a trick that I can use to avoid the use of a temporary table.
I have the same problem myself. There are techniques to make sure that your queries have all the necessary keys available to them, so that temporary tables are not needed. The EXPLAIN command does wonders to help you debug these issues.
HOWEVER ... in my experience sometimes MySQL uses temporary tables anyhow. I have been trying to optimize a certain query for months now, and I'm starting to conclude that it can't be done. I hope I'm wrong, because I really like MySQL otherwise.