From: Thomas Pundt <mlists@rp-online.de>
To: pgsql-performance@postgresql.org, Francisco Reyes <lists@stringsutils.com>
Subject: Re: Group by more efficient than distinct?
Date: Fri, 18 Apr 2008 09:25:04 +0100
Message-ID: <200804181025.04277.mlists@rp-online.de> (raw)
In-Reply-To: <cone.1208490368.136870.53107.1000@zoraida.natserv.net>
References: <cone.1208490368.136870.53107.1000@zoraida.natserv.net>
On Freitag, 18. April 2008, Francisco Reyes wrote:
| I am trying to get a distinct set of rows from 2 tables.
| After looking at someone else's query I noticed they were doing a group by
| to obtain the unique list.
|
| After comparing on multiple machines with several tables, it seems using
| group by to obtain a distinct list is substantially faster than using
| select distinct.
|
| Is there any dissadvantage of using "group by" to obtain a unique list?
Searching the archives suggests that the code related to "group by" is much
newer than the one related to "distinct" and thus might benefit from more
optimization paths.
Ciao,
Thomas
--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----
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-performance@postgresql.org
Cc: mlists@rp-online.de, lists@stringsutils.com
Subject: Re: Group by more efficient than distinct?
In-Reply-To: <200804181025.04277.mlists@rp-online.de>
* 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