From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Devrim GUNDUZ" <devrim(at)oper(dot)metu(dot)edu(dot)tr>, "PostgreSQL Mailing Lists-SQL" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: performance comparison: DISTINCT and GROUP BY |
Date: | 2002-08-19 12:26:21 |
Message-ID: | 003501c2477b$a1114bd0$0200a8c0@SOL |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Devrim,
You can use the EXPLAIN ANALYZE syntax to find out quite easily.
Chris
----- Original Message -----
From: "Devrim GUNDUZ" <devrim(at)oper(dot)metu(dot)edu(dot)tr>
To: "PostgreSQL Mailing Lists-SQL" <pgsql-sql(at)postgresql(dot)org>
Sent: Monday, August 19, 2002 7:22 PM
Subject: [SQL] performance comparison: DISTINCT and GROUP BY
>
> Hi,
>
> We have two different queries:
>
> SELECT name,surname FROM my_table GROUP BY name;
>
> and
>
> SELECT DISTINCT on(name) name,surname * FROM my_table;
>
> which gives us the same result.
>
> Do these queries differ by their performances? I mean, which one works
> faster? DISTINCT or GROUP BY?
>
> Best regards.
>
> --
>
> Devrim GUNDUZ
>
> devrim(at)oper(dot)metu(dot)edu(dot)tr Tel : (312) 295 9318
> devrim(dot)gunduz(at)linux(dot)org(dot)tr Faks : (312) 295 9494
>
> Web : http://devrim.oper.metu.edu.tr
> -------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Fritz Lehmann-Grube | 2002-08-19 13:18:57 | recursive function returning "setof" |
Previous Message | Devrim GUNDUZ | 2002-08-19 11:22:08 | performance comparison: DISTINCT and GROUP BY |