Skip site navigation (1) Skip section navigation (2)

Re: Extracting superlatives - SQL design philosophy

From: Richard Huxton <dev(at)archonet(dot)com>
To: Dave Crooke <dcrooke(at)gmail(dot)com>
Cc: Garrett Murphy <gmurphy(at)lawlogix(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Extracting superlatives - SQL design philosophy
Date: 2010-02-24 23:12:25
Message-ID: 4B85B259.4030900@archonet.com (view raw or flat)
Thread:
Lists: pgsql-performance
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

In response to

Responses

pgsql-performance by date

Next:From: Dave CrookeDate: 2010-02-24 23:37:11
Subject: Re: Extracting superlatives - SQL design philosophy
Previous:From: Dave CrookeDate: 2010-02-24 22:47:54
Subject: Re: Extracting superlatives - SQL design philosophy

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group