Not according to the optimizer! Plus, this is not guaranteed to return the correct results.
For it to be fast you need an index on (stock_id, price_date) so that you can use an index scan.
I already said that such an index existed. In fact, it is the primary key of the table. And yes, I *am* analyzed!
The answers are guarenteed to be correct. See: http://developer.postgresql.org/docs/postgres/sql-select.html#SQL-DISTINCT
That's good to know. Thanks!
Ken
---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])