count(*) bag ?

From: Konstantin Tokar <lists(at)tokar(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: count(*) bag ?
Date: 2002-10-26 11:48:42
Message-ID: 921945016.20021026154842@tokar.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

I use PostgreSQL 7.2.3 on i686-pc-linux-gnu, compiled by GCC
2.95.3 . count(*) very slowly.

CREATE TABLE r2 (
r2_id int4 NOT NULL,
a int4 DEFAULT 1,
label varchar(255),
CONSTRAINT r2_pkey PRIMARY KEY (r2_id)
) WITH OIDS;

insert into r2 select * from r; # The table with the same structure

vacuum;

select count(*) from r2;

Aggregate (cost=100010594.30..100010594.30 rows=1 width=0)
-> Seq Scan on r2 (cost=100000000.00..100009620.04 rows=389704 width=0)

Why not used primary key index?

(But select * from r2 where r2_id=1111111; uses this index)

--
Konstantin

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2002-10-26 16:40:39 Re: count(*) bag ?
Previous Message Michael Conn 2002-10-26 06:29:48 Technical Question