Re: Problem using Subselect results

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: oheinz(at)stud(dot)fbi(dot)fh-darmstadt(dot)de, pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem using Subselect results
Date: 2003-07-30 18:08:56
Message-ID: 200307301108.56047.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Oliver,

> SELECT DISTINCT ON (two.two_id) two.two_value FROM one,two WHERE
> (one.two_id=two.two_id
> AND one.updatenr > two.updatenr) ORDER BY two.updatenr ASC;

FWIW, SELECT DISTINCT ON () is slower than SELECT .... ORDER BY ... LIMIT 1 on
all stable versions of Postgres. Not that the LIMIT 1 method can be used
with all queries.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-07-30 19:25:18 Re: [SQL] ALTER TABLE ... DROP CONSTRAINT
Previous Message Josh Berkus 2003-07-30 17:28:50 Re: [SQL] function returning setof performance question