| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
|---|---|
| To: | Ed Loehr <eloehr(at)austin(dot)rr(dot)com> |
| 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:24:15 |
| Message-ID: | 200006011924.PAA23802@candle.pha.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
> 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.
--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ed Loehr | 2000-06-01 19:32:10 | Re: btree index and max() |
| Previous Message | Ross J. Reedstrom | 2000-06-01 19:11:05 | Re: ALTERING A TABLE |