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

Re: Much Ado About COUNT(*)

From: Rod Taylor <pg(at)rbt(dot)ca>
To: "Jonah H(dot) Harris" <jharris(at)tvi(dot)edu>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Much Ado About COUNT(*)
Date: 2005-01-12 22:03:58
Message-ID: 1105567438.690.76.camel@home (view raw or flat)
Thread:
Lists: pgsql-announcepgsql-hackerspgsql-patches
> >The index could then make sensible the reasonably common practice of
> >using a covered index - i.e. putting additional columns into the index
> >to satisfy the whole query just from the index.

> I am willing to take it on and I understand that the workload is mine.  
> As long as everyone gives me some suggestions, I'm good it being optional.

If nobody is working on it, you may find that the below TODO item might
accomplish most of what you're looking for as well as generally
improving performance. The count(*) on a where clause would result in
one index scan and one partial sequential heap scan. Not as fast for the
specific examples you've shown, but far better than today and covers
many other cases as well.

        Fetch heap pages matching index entries in sequential order 
        
        Rather than randomly accessing heap pages based on index
        entries, mark heap pages needing access in a bitmap and do the
        lookups in sequential order. Another method would be to sort
        heap ctids matching the index before accessing the heap rows.


In response to

pgsql-announce by date

Next:From: Jeff DavisDate: 2005-01-13 02:45:09
Subject: Re: Much Ado About COUNT(*)
Previous:From: Jonah H. HarrisDate: 2005-01-12 21:58:14
Subject: Re: Much Ado About COUNT(*)

pgsql-hackers by date

Next:From: Mark WongDate: 2005-01-12 22:18:36
Subject: sparse (static analyzer) report
Previous:From: Jim ButtafuocoDate: 2005-01-12 21:59:43
Subject: Re: PANIC: right sibling's left-link doesn't match

pgsql-patches by date

Next:From: Jeff DavisDate: 2005-01-13 02:45:09
Subject: Re: Much Ado About COUNT(*)
Previous:From: Jonah H. HarrisDate: 2005-01-12 21:58:14
Subject: Re: Much Ado About COUNT(*)

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