pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Peter Childs <peterachilds@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: optimize query with a maximum(date) extraction
Date: Wed, 05 Sep 2007 11:23:38 -0400
Message-ID: <13389.1189005818@sss.pgh.pa.us> (raw)
In-Reply-To: <87ps0xp4nu.fsf@oxford.xeocode.com>
References: <302443.65402.qm@web26209.mail.ukl.yahoo.com>
	<87abs1qrhu.fsf@oxford.xeocode.com>
	<87642pqpue.fsf@oxford.xeocode.com>
	<a2de01dd0709050543j57de8774s9e9e0a576cc21bd1@mail.gmail.com>
	<162867790709050548l3e1fd155g40b745f2ae42834e@mail.gmail.com>
	<87ps0xp4nu.fsf@oxford.xeocode.com>

Gregory Stark <stark@enterprisedb.com> writes:
> You can simulate such a plan with the subqueries I described but
> there's a bit more overhead than necessary and you need a reasonably
> efficient source of the distinct ids.

Yeah, that seems like the $64 question.  If you have no better way of
finding out the set of ID values than a seqscan, then there's no point
in trying to optimize the min/max accumulation ...

			regards, tom lane



view thread (12+ messages)  latest in thread

Message-ID: <13389.1189005818@sss.pgh.pa.us>
Permalink:  ../13389.1189005818@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13389.1189005818@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-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stark@enterprisedb.com, pavel.stehule@gmail.com, peterachilds@gmail.com
  Subject: Re: optimize query with a maximum(date) extraction
  In-Reply-To: <13389.1189005818@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