From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
Cc: | Greg Stark <gsstark(at)MIT(dot)EDU>, Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Suggestion for aggregate function |
Date: | 2003-01-18 00:08:06 |
Message-ID: | 87fzrr1frt.fsf@stark.dyndns.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Manfred Koizar <mkoi-pg(at)aon(dot)at> writes:
> Greg, we already have this feature, just the syntax is a bit different :-)
>
> SELECT DISTINCT ON (item_id) item_id,
> price AS lowest_price,
> store_id AS lowest_price_store
> FROM items_for_sale
> WHERE item_category = ?
> ORDER BY item_id, price
Neat! I hadn't seen this. I would have liked to have had that feature on
Oracle! (Please don't tell me I did, I went through such pains to work around
not having it.)
Would this query be efficient if there's an index on item_id, price ? That is,
would it know to do an index scan and be able to skip to the next item_id in
the index as soon as a price was found?
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Jochem van Dieten | 2003-01-18 00:48:58 | Re: Win32 port (native) |
Previous Message | Tom Lane | 2003-01-17 23:17:12 | Re: Suggestion for aggregate function |