Re: Quota query with decent performance? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Quota query with decent performance?
Date
Msg-id 5855.1068614278@sss.pgh.pa.us
Whole thread Raw
In response to Re: Quota query with decent performance?  (Josh Berkus <josh@agliodbs.com>)
List pgsql-sql
Josh Berkus <josh@agliodbs.com> 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


pgsql-sql by date:

Previous
From: Chester Kustarz
Date:
Subject: Re: Quota query with decent performance?
Next
From: Troels Arvin
Date:
Subject: Re: Quota query with decent performance?