Manfred Koizar <[EMAIL PROTECTED]> 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


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to