MySQL Forums
Forum List  »  Performance

Distinct or Group by which is faster
Posted by: Ra Nala
Date: February 22, 2016 08:50AM

Hi Sir,Madam,

We are trying to retrieve 500000 records and in one of the scenario i need to retrieve only 3 columns instead of all columns.

My data consists duplicates so when i retrieve data for 3 columns i am getting all 500000 records.

To avoid the issue i can use simply DISTINCT or GROUP BY clause but confused about the best approach. I googled but no one was given clarity.

which is better, kindly help me which is better approach?


select DISTINCT id,name,age from employee

OR

select id,name,age from employee group by id

thanks,
Ra na la

Options: ReplyQuote


Subject
Views
Written By
Posted
Distinct or Group by which is faster
1825
February 22, 2016 08:50AM


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.