In response to "Dave Dutcher" <dave@xxxxxxxxxxxx>: > > -----Original Message----- > > From: SPMLINGAM > > Subject: 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@xxxxxxxxxxxxxxxxxxxxxxx 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. **************************************************************** -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-performance