"Gordan Bobic" <gordan@freeuk.com> writes:
> It just seems a bit strange
> that doing subqueries with temporary tables should be so much faster.
Hard to respond to this complaint without a specific example.
> SELECT DISTINCT ON (Table1.Field3) * FROM SomeView. I would hope that
> DISTINCT would pick the first record returned for each of the different
> occurences in SomeView.
It does, but kindly notice that you have not constrained what the first
record returned is. See the example of SELECT DISTINCT ON usage in the
SELECT reference page,
http://www.postgresql.org/users-lounge/docs/7.0/postgres/sql-select.htm
regards, tom lane