Re: Improving count(*) - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: Improving count(*)
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3417DD910@Herge.rcsinc.local
Whole thread Raw
In response to Improving count(*)  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: Improving count(*)  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Improving count(*)  (Gregory Maxwell <gmaxwell@gmail.com>)
List pgsql-hackers
> In Sybase ASE (and I'm pretty sure the same is true in Microsoft SQL
> Server) the leaf level of the narrowest index on the table is scanned,
> following a linked list of leaf pages.  Leaf pages can be pretty dense
> under Sybase, because they do use prefix compression.  A count(*)
> on a table with 100 million rows is going to take a few minutes, but
it
> is going to be at least an order of magnitude faster than a data page
> scan -- maybe two orders of magnitude faster.

MS SQL server (pre 2005) is not an MVCC database, so it's not apples to
apples with pg.  Many of the people who wander on this list and complain
about count(*) either come from one of those or some other non-MVCC
database or worse, a flat-file xbase type system.  A performance
comparison between MS 2005 and pg would be much more interesting.
Personally, I don't know what all the fuss is about [although I wouldn't
complain about an optimization ;)].

Merlin



pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: CLUSTER and clustered indices
Next
From: Alvaro Herrera
Date:
Subject: Re: Improving count(*)