count(*) bag ? - Mailing list pgsql-bugs

From Konstantin Tokar
Subject count(*) bag ?
Date
Msg-id 921945016.20021026154842@tokar.ru
Whole thread Raw
Responses Re: count(*) bag ?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List 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

pgsql-bugs by date:

Previous
From: Bhuvan A
Date:
Subject: Re: Bug #804: plpgsql not work on solaris
Next
From: Stephan Szabo
Date:
Subject: Re: count(*) bag ?