As Always, it depends.
The Group By is generally used in conjunction with functions for summarizing data (Average, Sum, etc)
Using Group By, if you have fields that will use a function, of course that will take longer than with-out those fields.
So, I guess, when comparing Distinct and Group By, we are comparing only an Sql statement which returns only fields and no functions (which anyways, only GROUP BY can do).
So the next factor, is the number of fields being returned.
When returning only one or two fields in a large table, then the DISTINCT will/should be much faster under normal circumstances.
However, when returning more than just a few fields from a large table (4,5,n), then the GROUP BY will probably be faster.
The number of fields vs. SELECT method vs. speed mentioned above is of course dependent on several factors, such as number of records and number of fields in the table itself.
So, I am just using an average size as criteria with respect to which method is faster based upon the number of fields returned.
Now, there are other factors, such as criteria and sorting that will affect the speed.
Criteria in a GROUPY BY using HAVING instead of WHERE will slow the results down more so.
Sorting the records is probably the biggest speed killer.
Always best not to use an ORDER BY if it is not really needed, and/or leave it up to the user to sort the records if desired.
Or, if using a client cursor, use the ADO's Sort method after the data is collected. The sort will then be done locally using the cached indexes.
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!