Re: Thanks, naming conventions, and count() - Mailing list pgsql-hackers

From Casey Lyon
Subject Re: Thanks, naming conventions, and count()
Date
Msg-id 3AECDE4D.5060608@earthcars.com
Whole thread Raw
In response to Re: Thanks, naming conventions, and count()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Thanks, naming conventions, and count()  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:

> The problem here is that now we don't have commit status in the index
> rows, so they have to check the heap for every row.  One idea is to
> update the index status on an index scan, and if we can do that, we can
> easily use the index.  However, the table scan is pretty quick.

It certainly works quickly for smaller tables, however the 21.7 million
record table I ran this on takes a touch longer as shown here:

database=# explain select count(*) from table;
NOTICE:  QUERY PLAN:

Aggregate  (cost=478056.20..478056.20 rows=1 width=0)  ->  Seq Scan on table  (cost=0.00..423737.76 rows=21727376
width=0)

EXPLAIN

However I noted explain provides rows as part of it's data; from what
I've seen this loses precision over time or with large data imports,
though; at least until the table is vacuumed again.

-Casey



pgsql-hackers by date:

Previous
From: Casey Lyon
Date:
Subject: Re: Thanks, naming conventions, and count()
Next
From: The Hermit Hacker
Date:
Subject: Re: Thanks, naming conventions, and count()