pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Dave Crooke <dcrooke@gmail.com>
Cc: Garrett Murphy <gmurphy@lawlogix.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Extracting superlatives - SQL design philosophy
Date: Wed, 24 Feb 2010 23:12:25 +0000
Message-ID: <4B85B259.4030900@archonet.com> (raw)
In-Reply-To: <ca24673e1002241447i2209385cvc11fafa1e37f67bf@mail.gmail.com>
References: <ca24673e1002241331l4099482aqc73649d93611767a@mail.gmail.com>
	<076DC33A3D38CE4BBC64D35DDD9DE70C0A17259D@mse4be2.mse4.exchange.ms>
	<ca24673e1002241447i2209385cvc11fafa1e37f67bf@mail.gmail.com>

On 24/02/10 22:47, Dave Crooke wrote:
> I'd imagine it would be possible to have a query planner optimization
> that would convert Garrett's DISTINCT ON syntax to do what I was
> trying to, by realizing that DISTINCT ON X ... ORDER BY Y DESC is
> going to return the the one row for each X which has the highest value
> of Y, and so use a MAX-structured accumulation instead of a sort.

Why is there only one row? For city temperatures, that seems unlikely.

In the event of more than one row does your algorithm give repeatable 
results?

-- 
   Richard Huxton
   Archonet Ltd



view thread (15+ messages)  latest in thread

Message-ID: <4B85B259.4030900@archonet.com>
Permalink:  ../4B85B259.4030900@archonet.com/
Also on:    postgresql.org/message-id/4B85B259.4030900@archonet.com

 · 

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: dev@archonet.com, dcrooke@gmail.com, gmurphy@lawlogix.com
  Subject: Re: Extracting superlatives - SQL design philosophy
  In-Reply-To: <4B85B259.4030900@archonet.com>

* 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