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

Re: min/max planner optimization

From: "Gokulakannan Somasundaram" <gokul007(at)gmail(dot)com>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: min/max planner optimization
Date: 2007-10-27 15:18:29
Message-ID: 9362e74e0710270818u44651793r4a25e8118158c45@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,
   I don't know whether this input would be useful. But what i could observe
from the behavior of MIN/MAX is

It goes to the proper page, but starts the page scan in a opposite way. Say
for example you want the min value, it goes to the first leaf page, but
starts from the last tuple and comes to the top. For Max, it goes to the
last page and starts scanning from top and reaches the bottom. If some extra
information can be passed on to the scan, saying whether it is a min/max
oper, then we can tune this part. I don't know how much we will save from
this in-memory operation. But it would definitely do lesser work.

Thanks,
Gokul.


On 10/27/07, Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
>
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
> > The only case where the optimization is a win is where you have a
> > zero-startup-cost subplan, and the only way to get sorted output with
> zero
> > startup cost is an indexscan.
>
> Sure but there could be other nodes above the index scan which preserve
> the
> order. In particular nested loop and merge joins. Unique also preserves
> the
> order but I can't see how it could be useful here. And of course
> potentially
> Append nodes in the future...
>
> --
>   Gregory Stark
>   EnterpriseDB          http://www.enterprisedb.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>



-- 
Thanks,
Gokul.
CertoSQL Project,
Allied Solution Groups.
(www.alliedgroups.com)

In response to

pgsql-hackers by date

Next:From: Florian G. PflugDate: 2007-10-27 16:36:16
Subject: Re: module archive
Previous:From: Tom LaneDate: 2007-10-27 15:04:19
Subject: Re: Datum should be defined outside postgres.h

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