Re: btree index and max()

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: leonbloy(at)sinectis(dot)com(dot)ar, pgsql-general(at)postgresql(dot)org
Subject: Re: btree index and max()
Date: 2000-06-01 19:32:10
Message-ID: 3936BA3A.520A5ADC@austin.rr.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote:
>
> > leonbloy(at)sinectis(dot)com(dot)ar wrote:
> > >
> > > => explain select max(rid) from facturas;
> > > NOTICE: QUERY PLAN:
> > >
> > > Aggregate (cost=21139.66 rows=342414 width=4)
> > > -> Seq Scan on facturas (cost=21139.66 rows=342414 width=4)
> > >
> > > I understand that the query planner cannot be so clever
> > > to grasp that this particular function (max or min)
> > > might be evaluated by just travelling the BTREE index.
> > > Am I correct?
> >
> > I believe you are unfortunately correct. :(
>
> That would be a good optimization. Let me add it to the TODO list.
> Much better than trying to keep the max stored somewhere.

There was a lot of discussion about this on the hackers list recently,
but I don't recall the outcome.

Regards,
Ed Loehr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-06-01 19:39:28 Re: shared memory
Previous Message Bruce Momjian 2000-06-01 19:24:15 Re: btree index and max()