From: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
To: Devrim GUNDUZ <devrim@oper.metu.edu.tr>
To: PostgreSQL Mailing Lists-SQL <pgsql-sql@postgresql.org>
Subject: Re: performance comparison: DISTINCT and GROUP BY
Date: Mon, 19 Aug 2002 20:26:21 +0800
Message-ID: <003501c2477b$a1114bd0$0200a8c0@SOL> (raw)
References: <Pine.LNX.4.44.0208191340200.4893-100000@oper.metu.edu.tr>
Hi Devrim,
You can use the EXPLAIN ANALYZE syntax to find out quite easily.
Chris
----- Original Message -----
From: "Devrim GUNDUZ" <devrim@oper.metu.edu.tr>
To: "PostgreSQL Mailing Lists-SQL" <pgsql-sql@postgresql.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@oper.metu.edu.tr Tel : (312) 295 9318
> devrim.gunduz@linux.org.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@postgresql.org)
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: chriskl@familyhealth.com.au, devrim@oper.metu.edu.tr
Subject: Re: performance comparison: DISTINCT and GROUP BY
In-Reply-To: <003501c2477b$a1114bd0$0200a8c0@SOL>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox