pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@collaborativefusion.com>
To: Dave Dutcher <dave@tridecap.com>
Cc: 'SPMLINGAM' <spmlingam@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: postgresql performance
Date: Wed, 5 Mar 2008 11:00:13 -0500
Message-ID: <20080305110013.68f1e08a.wmoran@collaborativefusion.com> (raw)
In-Reply-To: <01b501c87eca$8da00ff0$8e00a8c0@tridecap.com>
References: <15847165.post@talk.nabble.com>
	<01b501c87eca$8da00ff0$8e00a8c0@tridecap.com>

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.
****************************************************************



view thread (16+ messages)

Message-ID: <20080305110013.68f1e08a.wmoran@collaborativefusion.com>
Permalink:  ../20080305110013.68f1e08a.wmoran@collaborativefusion.com/
Also on:    postgresql.org/message-id/20080305110013.68f1e08a.wmoran@collaborativefusion.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: wmoran@collaborativefusion.com, dave@tridecap.com, spmlingam@gmail.com
  Subject: Re: postgresql performance
  In-Reply-To: <20080305110013.68f1e08a.wmoran@collaborativefusion.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox