Order by clause in 'select distinct'?

From: "James Kelty" <jamesk(at)ashlandagency(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Order by clause in 'select distinct'?
Date: 2002-03-13 21:41:27
Message-ID: MDEDIKPCLCIKDGEMDJGMOEHECDAA.jamesk@ashlandagency.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

When I create a view by a query like the follow query:

SELECT DISTINCT ON (o.ordergenkey) o.ordergenkey, lip.payment FROM Ordr o,
LineItemPayment lip
WHERE o.ordergenkey = lip.orderfkey
and o.ordergenkey = ?

The view is created with an ORDER BY clause on the o.ordergenkey...

I think it might be an enforce rule for createing a view with a DISTINCT ON
phrase.

I would like to, if possible, get rid of the ORDER BY clause as it slow the
query to
a crawl.

Any ideas?

-James

James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
541.488.0801
jamesk(at)ashlandagency(dot)com

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Schuller 2002-03-13 22:20:41 Postgres user lost its access
Previous Message Stephan Szabo 2002-03-13 21:21:38 Re: Optimizing a condition based on an a very unequally