Re: GROUP BY vs DISTINCT
- From: "Warrio" <warrio@xxxxxxxxxxx>
- Date: Fri, 1 Jun 2007 17:37:19 +0200
Great Thanks Michel for your answer! exactly what I was looking for! :)
I'll have probably to think about it again once or twice so I can really
have a vision of how the memory is allocated!
John, the best way would be to have the code that's behind these GROUP BY
and DISTINCT
the test won't concern a big time difference, plus there is too many
variables within the same machine, you'd have only an average.
thanks again.
"John Spencer" <spencer@xxxxxxxxx> a écrit dans le message de news:
uUQJnDGpHHA.3952@xxxxxxxxxxxxxxxxxxxxxxx
I am not sure you are correct in your evaluation. I think the only way to
know would be to test with data and to run the tests multiple times.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
"Michel Walsh" <vanderghast@VirusAreFunnierThanSpam> wrote in message
news:%23mwPg7FpHHA.4512@xxxxxxxxxxxxxxxxxxxxxxx
GROUP BY will NOT be slower, since it forces you to specify which
field(s) you really need to define 'unique-ness', it will be faster, or
take the same time, at worst, than DISTINCT, but note that GROUP BY is
more rigid than DISTINCT, since any expression in the SELECT clause must
then be either in the GROUP BY, either aggregated.
SELECT DISTINCT lastName, firstName, telNumber FROM somewhere
will be slower than
SELECT lastName, firstName, MAX(telNumber) FROM somewhere GROUP BY
lastName, firstName
since not only distinct will uselessly compare the telNumber field, but
it will also reserve memory to keep it as 'group identifier'; the second
solution neither does the comparison, neither has to reserve that extra
memory.
Vanderghast, Access MVP
"Warrio" <warrio@xxxxxxxxxxx> wrote in message
news:466025fe$0$3806$5402220f@xxxxxxxxxxxxxxxxxx
Hello!
Which of GROUP BY and DISTINCT is the quickest? and why?
Thanks for any relevant answer!
PS: Please don't tell me that there is no difference because it's a
matter of one millionth second.
.
- Follow-Ups:
- Re: GROUP BY vs DISTINCT
- From: Baz
- Re: GROUP BY vs DISTINCT
- References:
- GROUP BY vs DISTINCT
- From: Warrio
- Re: GROUP BY vs DISTINCT
- From: Michel Walsh
- Re: GROUP BY vs DISTINCT
- From: John Spencer
- GROUP BY vs DISTINCT
- Prev by Date: Re: My running sum didn't work
- Next by Date: Re: Select Union Query Help Needed
- Previous by thread: Re: GROUP BY vs DISTINCT
- Next by thread: Re: GROUP BY vs DISTINCT
- Index(es):
Relevant Pages
|
Loading