pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Ron St-Pierre <rstpierre@syscor.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: ORDER BY and LIMIT with SubSelects
Date: Wed, 21 Jan 2004 12:36:56 -0600
Message-ID: <20040121183656.GC11684@wolff.to> (raw)
In-Reply-To: <400EB45A.40309@syscor.com>
References: <400EB45A.40309@syscor.com>

On Wed, Jan 21, 2004 at 09:18:18 -0800,
  Ron St-Pierre <rstpierre@syscor.com> wrote:
> 
> My question is in regards to steps 2 and 3 above. Is there some way that 
> I can combine both steps into one to save some time?
 
TIP 4: Don't 'kill -9' the postmaster
SELECT SS.* FROM
(SELECT DISTINCT ON (nonUniqField)
 first, second, third, cost, payDate, nonUniqField
 FROM histdata
 WHERE userID = 19048 AND cost IS NOT NULL 
 ORDER BY nonUniqField, payDate DESC LIMIT 200
)
SS  
ORDER BY payDate;



view thread (2+ messages)

Message-ID: <20040121183656.GC11684@wolff.to>
Permalink:  ../20040121183656.GC11684@wolff.to/
Also on:    postgresql.org/message-id/20040121183656.GC11684@wolff.to

 · 

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-performance@postgresql.org
  Cc: bruno@wolff.to, rstpierre@syscor.com
  Subject: Re: ORDER BY and LIMIT with SubSelects
  In-Reply-To: <20040121183656.GC11684@wolff.to>

* 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