From: Gary Cowell <gary_cowell@yahoo.co.uk>
To: pgsql-performance@postgresql.org
Subject: Re: Major differences between oracle and postgres performance - what can I do ?
Date: Sat, 19 Jun 2004 00:06:29 +0100 (BST)
Message-ID: <20040618230629.47789.qmail@web25101.mail.ukl.yahoo.com> (raw)
In-Reply-To: <25464.1087591637@sss.pgh.pa.us>
--- Tom Lane <tgl@sss.pgh.pa.us> wrote: >
=?iso-8859-1?q?Gary=20Cowell?=
> <gary_cowell@yahoo.co.uk> writes:
> > So it seems the idea that oracle is dropping
> duplicate
> > rows prior to the sort when using distinct may
> indeed
> > be the case.
>
> Okay. We won't have any short-term solution for
> making DISTINCT do that,
> but if you are on PG 7.4 you could get the same
> effect from using
> GROUP BY: instead of
> select distinct version from vers where version is
> not null
> try
> select version from vers where version is not null
> group by version
> You should get a HashAggregate plan out of that, and
> I'd think it'd be
> pretty quick when there are not many distinct values
> of version.
>
Yeah out of the half million rows there are only ever
going to be 500 or so distinct values.
I do indeed get such a plan. It's much faster that
way. Down to 16 seconds. I'll get the chap to rewrite
his app to use group by instead of distinct.
Thanks (everyone) for the top class help!
___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: gary_cowell@yahoo.co.uk
Subject: Re: Major differences between oracle and postgres performance - what can I do ?
In-Reply-To: <20040618230629.47789.qmail@web25101.mail.ukl.yahoo.com>
References: <25464.1087591637@sss.pgh.pa.us> <20040618230629.47789.qmail@web25101.mail.ukl.yahoo.com>
* 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