pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: josh@agliodbs.com
Cc: Troels Arvin <troels@arvin.dk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Quota query with decent performance?
Date: Wed, 12 Nov 2003 00:17:58 -0500
Message-ID: <5855.1068614278@sss.pgh.pa.us> (raw)
In-Reply-To: <200311111541.34660.josh@agliodbs.com>
References: <pan.2003.11.11.22.58.08.758402@arvin.dk>
	<200311111541.34660.josh@agliodbs.com>

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



view thread (13+ messages)  latest in thread

Message-ID: <5855.1068614278@sss.pgh.pa.us>
Permalink:  ../5855.1068614278@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5855.1068614278@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, troels@arvin.dk
  Subject: Re: Quota query with decent performance?
  In-Reply-To: <5855.1068614278@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox