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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-performance by date

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