Re: Quota query with decent performance?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: Troels Arvin <troels(at)arvin(dot)dk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Quota query with decent performance?
Date: 2003-11-12 05:17:58
Message-ID: 5855.1068614278@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus <josh(at)agliodbs(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Troels Arvin 2003-11-12 09:32:30 Re: Quota query with decent performance?
Previous Message Chester Kustarz 2003-11-11 23:49:31 Re: Quota query with decent performance?