count * performance issue

From: "sathiya psql" <sathiya(dot)psql(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: count * performance issue
Date: 2008-03-06 05:43:01
Message-ID: f966c2ee0803052143k4570d771o6c300647d3b987d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

count(*) tooks much time...

but with the where clause we can make this to use indexing,... what where
clause we can use??

Am using postgres 7.4 in Debian OS with 1 GB RAM,

am having a table with nearly 50 lakh records,

it has more than 15 columns, i want to count how many records are there, it
is taking nearly 17 seconds to do that...

i know that to get a approximate count we can use
SELECT reltuples FROM pg_class where relname = TABLENAME;

but this give approximate count, and i require exact count...

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Chris 2008-03-06 05:46:15 Re: Confirmação de envio / Sending confirmation (captchaid:13266b20536d)
Previous Message petchimuthu lingam 2008-03-06 05:17:39 Confirmação de envio / Sending confirmation (captchaid:13266b20536d)