MySQL Forums
Forum List  »  Optimizer & Parser

Prevent DISTINCT from using temporary tables
Posted by: Eric Lyons
Date: August 25, 2008 09:07PM

This is probably a newbie question, but here is my query:

mysql> explain select distinct(chromosome) from genomic_sequence where dataset_id = 1;
+----+-------------+------------------+------+---------------+------------+---------+-------+------+------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------------+------+---------------+------------+---------+-------+------+------------------------------+
| 1 | SIMPLE | genomic_sequence | ref | dataset_id | dataset_id | 4 | const | 2896 | Using where; Using temporary |
+----+-------------+------------------+------+---------------+------------+---------+-------+------+------------------------------+
1 row in set (0.00 sec)

Which is using a temp table that slows down the query. Is there any way around this?


Thanks,
-eric

Options: ReplyQuote


Subject
Views
Written By
Posted
Prevent DISTINCT from using temporary tables
13338
August 25, 2008 09:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.