MySQL Forums
Forum List  »  MyISAM

Re: SELECT DISTINCT vs UNIQUE KEY
Posted by: Ingo Strüwing
Date: July 19, 2006 02:06AM

For more exact answers on this I suggest to ask in the "Optimizer" forum again.

I can just guess that SELECT DISTINCT orders the result set to eliminate duplicates. The result set and/or the sort files might not fit into memory (tmp_table_size, sort_buffer_size).

The INSERT SELECT algorithm does not require to store the whole result set. Every row can immediately be checked against the unique index.

It would be nice if the optimizer used this algorithm for SELECT DISTINCT implicitly, but seemingly it does not.

Options: ReplyQuote


Subject
Views
Written By
Posted
6581
July 18, 2006 04:39AM
Re: SELECT DISTINCT vs UNIQUE KEY
2382
July 19, 2006 02:06AM


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.