Is there any performance difference between DISTINCT and GROUP BY?

I have a table articles and I want to get unique users who posted the articles. userid has an index. What should I use DISTINCT or GROUP BY? Is there any difference between their performance? I am concerned about the performance.

I need to get only userid from articles. Which one is better?

SELECT DISTINCT userid FROM articles WHERE posted_date BETWEEN ‘2007-01-01’ AND CURDATE();


SELECT userid FROM articles WHERE posted_date BETWEEN ‘2007-01-01’ AND CURDATE() GROUP BY userid;

EXPLAIN is exactly the same for both.

It’ll reduce to the same pathway for both, however I prefer to use “GROUP BY” as it seems more logical to me and increases usability IMO.

I am looking for some definite answer.

There is no performance difference.

Since, as Speeple said, mysql is performing the exact same execution to perform the two queries.

So essentially it is just a matter of syntax in this case, the end result is the same.