does "select count(*) from mytable" always do a seq scan?

From: Culley Harrelson <harrelson(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: does "select count(*) from mytable" always do a seq scan?
Date: 2005-01-07 14:45:57
Message-ID: 529825a3050107064538c85b55@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am using Postgresql 7.4. I have a table with 1.5 million rows. It
has a primary key. VACUUM FULL ANALYZE is run every night. There are
2000-5000 inserts on this table every day but very few updates and
deletes. When I select count(*) from this table it is using a
sequence scan. Is this just life or is there some way to get this to
do an index scan?

culley

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2005-01-07 15:17:16 Re: does "select count(*) from mytable" always do a seq
Previous Message Lonni J Friedman 2005-01-07 14:44:18 Re: PostgreSQL Deployment