Re: postgresql performance

From: Bill Moran <wmoran(at)collaborativefusion(dot)com>
To: "Dave Dutcher" <dave(at)tridecap(dot)com>
Cc: "'SPMLINGAM'" <spmlingam(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: postgresql performance
Date: 2008-03-05 16:00:13
Message-ID: 20080305110013.68f1e08a.wmoran@collaborativefusion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

In response to "Dave Dutcher" <dave(at)tridecap(dot)com>:

> > -----Original Message-----
> > From: SPMLINGAM
> > Subject: [PERFORM] postgresql performance
> >
> > Dear Friends,
> > I have a table with 50 lakhs records, the table has more
> > then 10 fields, i have primary key, i have select query with
> > count(*) without any condition, it takes 17 seconds.
>
> 17 seconds to scan 5 million records doesn't sound that bad to me.
> Postgresql does not store a count of records, and so it has to actually scan
> the table to count all the records. This was a design choice because select
> count(*) isn't usually used in a production system.

Note that if you need a fast count of the number of rows in a large
table, there are known workarounds to get it. Such as creating triggers
that update a count column, or using explain to get a quick estimate of
the number of rows (if that's acceptable).

--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran(at)collaborativefusion(dot)com
Phone: 412-422-3463x4023

****************************************************************
IMPORTANT: This message contains confidential information and is
intended only for the individual named. If the reader of this
message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.
****************************************************************

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Cramer 2008-03-06 00:27:13 Why the difference in plans ?
Previous Message Kevin Grittner 2008-03-05 15:46:05 Re: postgresql performance