"select count(*) from contacts" is too slow!

From: Paul Serby <paul(dot)serby(at)clockltd(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: "select count(*) from contacts" is too slow!
Date: 2003-10-07 17:09:33
Message-ID: 3F82F34D.9090608@clockltd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Why does '*select count(id) from "tblContacts"'* do a sequential scan
when the field '*id*' is indexed using a btree?

MySql simply looks at the index which is keeping a handy record of the
number of rows.

Can anybody explain how and why postgres does this query like it does?

Many thanks

Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2003-10-07 18:29:24 Re: "select count(*) from contacts" is too slow!
Previous Message Robert Treat 2003-10-07 17:07:56 Re: PostgreSQL Beta4 Tag'd and Bundle'd ...