Received: from megazone23.bigpanda.com ([216.136.151.41]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4UHkjE92263 for ; Wed, 30 May 2001 13:46:45 -0400 (EDT) (envelope-from sszabo@megazone23.bigpanda.com) Received: from localhost (sszabo@localhost) by megazone23.bigpanda.com (8.11.2/8.11.2) with ESMTP id f4UHkOl06493; Wed, 30 May 2001 10:46:24 -0700 (PDT) Date: Wed, 30 May 2001 10:46:24 -0700 (PDT) From: Stephan Szabo To: Koen Antonissen cc: Richard Poole , bernd , pgsql-sql@postgresql.org Subject: RE: primary key scans in sequence In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200105/338 X-Sequence-Number: 3179 On Wed, 30 May 2001, Koen Antonissen wrote: > Now this one doesn't: > Table "teams" > Attribute | Type | Modifier > -----------+---------+-------------------------------------------------- > id | integer | not null default nextval('teams_id_seq'::text) > name | text | not null > mgr_name | text | > address | text | > zipcode | text | > city | text | > country | text | > email | text | > telnr | text | > mobnr | text | > faxnr | text | > logo | text | not null default 'images/teams/logo_default.gif' > movie | text | > url | text | > qoute | text | > active | boolean | default 't'::bool > Indices: index_teams_id, <=!!! 'my own' index > index_teams_name, > teams_pkey, <=normal pkey index > unq_teams_name > > NOTICE: QUERY PLAN: > > Seq Scan on teams (cost=0.00..1.09 rows=1 width=173) Looking at that cost, I have to wonder, how many rows are in the table and has vacuum analyze been run on it? If the number of rows in the table is small, the seq scan is definately better than having to read from both the index and heap.