Josh Berkus <[EMAIL PROTECTED]> writes:
> Second, the query you post is one "SQL Standard" way, which is good for 
> portability but not for speed.  Frankly, I'm not convinced that it's even the
> best SQL standard way.  On the other databases, you seem happy to use 
> non-SQL-standard syntax, so let me give you one such solution in PostgreSQL:
> [snip]

I don't know of any very good solution in bog-standard SQL either.

Aside from the LIMIT-based solution that Josh offered, I recall that
Oleg Bartunov and Teodor Sigaev had some ideas about top-N-aggregate
solutions.  We didn't accept those into the main distribution (yet)
but if you dig in the PG list archives I think there is working code
available.  Try searching for "partial sorting".

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to