Re: [GENERAL] question (or feature-request): over ( partition by ... order by LIMIT N)

From: David Fetter <david(at)fetter(dot)org>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] question (or feature-request): over ( partition by ... order by LIMIT N)
Date: 2010-03-25 21:17:31
Message-ID: 20100325211731.GA16362@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Mar 24, 2010 at 06:31:59PM +0100, A. Kretschmer wrote:
> Hello @all,
>
> I know, i can do:
>
> select * from (select ... row_number() over (...) ...) foo where
> row_number < N
>
> to limit the rows per group, but the inner select has to retrieve
> the whole set of records and in the outer select most of them
> discarded.

That sounds like the optimizer's falling down on the job. Would this
be difficult to fix?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-03-25 21:43:50 Re: Performing FETCH ALL from a SCROLL CURSOR failing to return results
Previous Message Eliot Gable 2010-03-25 21:10:46 Performing FETCH ALL from a SCROLL CURSOR failing to return results

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-03-25 22:50:19 Re: Re: [GENERAL] question (or feature-request): over ( partition by ... order by LIMIT N)
Previous Message Simon Riggs 2010-03-25 19:48:06 Re: Re: [COMMITTERS] pgsql: Make standby server continuously retry restoring the next WAL