Re: So, is COUNT(*) fast now?

Kevin Grittner <kevin.grittner@wicourts.gov>

From: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
To: "Robert Haas" <robertmhaas@gmail.com>, "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: <pgsql-hackers@postgresql.org>
Date: 2011-10-24T17:38:34Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove pg_upgrade dependency on the 'postgres' database existing in the

Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
> I had wondered whether it'd be worth optimizing that along the
> lines of slot_getallattrs().  But most indexes probably have only
> one column, or anyway not enough to make for a useful savings.
 
>From a heavily-used production database:
 
cir=> select indnatts, count(*) from pg_index group by indnatts
order by indnatts;
 indnatts | count 
----------+-------
        1 |   200
        2 |   684
        3 |   155
        4 |    76
        5 |    43
        6 |    13
        7 |     2
        9 |     1
(8 rows)
 
This includes system table and TOAST table indexes (which seem to
have two columns).  There are over 400 user tables, each of which
has a primary key, so most primary keys in our database are more
than one column.
 
-Kevin