From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Gregory Maxwell <gmaxwell(at)gmail(dot)com> |
Cc: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Improving count(*) |
Date: | 2005-11-22 22:53:56 |
Message-ID: | 200511222253.jAMMrvS28448@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Gregory Maxwell wrote:
> On 11/21/05, Jim C. Nasby <jnasby(at)pervasive(dot)com> wrote:
> > What about Greg Stark's idea of combining Simon's idea of storing
> > per-heap-block xmin/xmax with using that information in an index scan?
> > ISTM that's the best of everything that's been presented: it allows for
> > faster index scans without adding a lot of visibility overhead to the
> > index heap, and it also allows VACUUM to hit only pages that need
> > vacuuming. Presumably this could also be used as the on-disk backing for
> > the FSM, or it could potentially replace the FSM.
>
> This should be a big win all around, especially now since in memory
> bitmaps make it more likely that some classes of queries will be pure
> index. I still think it would be useful to have a estimated_count()
> which switches to whatever method is needed to get a reasonably
> accurate count quickly (stats when there are no wheres we can't
> predict, sampling otherwise if the involved tables are large, and a
> normal count in other cases.)
Added to TODO:
* Add estimated_count(*) to return an estimate of COUNT(*)
This would use the planner ANALYZE statistatics to return an estimated
count.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-11-22 23:11:01 | Re: Improving count(*) |
Previous Message | Tom Lane | 2005-11-22 22:37:44 | A few pgindent oddities |