Re: Select max within max

From: Mladen Gogala <mgogala_at_yahoo.com>
Date: 11 Jul 2008 17:07:15 GMT
Message-ID: <48779343$0$1348$834e42db@reader.greatnowhere.com>


On Fri, 11 Jul 2008 04:42:20 -0700, Charles Hooper wrote:

> SELECT DISTINCT
> COLX,
> COLY,
> COLZ
> FROM
> (SELECT
> COLX,
> COLY OLD_COLY,
> MAX(COLY) OVER (PARTITION BY COLX) COLY, MAX(COLZ) OVER (PARTITION
> BY COLX, COLY) COLZ
> FROM
> T1)
> WHERE
> OLD_COLY=COLY;
And, if T1 has few thousand rows, it's going to be full table scan, window sort and sort distinct, in that order. In other words, the resource consumption will just explode. As this is obviously a report, materialized view looks like the only reasonable solution. This is a sort of "mad max" query.

-- 
http://mgogala.freehostia.com
Received on Fri Jul 11 2008 - 12:07:15 CDT

Original text of this message