Re: postgresql performance - Mailing list pgsql-performance

From Bill Moran
Subject Re: postgresql performance
Date
Msg-id 20080305110013.68f1e08a.wmoran@collaborativefusion.com
Whole thread Raw
In response to Re: postgresql performance  ("Dave Dutcher" <dave@tridecap.com>)
List pgsql-performance
In response to "Dave Dutcher" <dave@tridecap.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@collaborativefusion.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.
****************************************************************

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: postgresql performance
Next
From: Dave Cramer
Date:
Subject: Why the difference in plans ?