Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D84CC2E08B5 for ; Wed, 5 Mar 2008 11:09:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 87134-04 for ; Wed, 5 Mar 2008 11:09:23 -0400 (AST) X-Greylist: delayed 00:59:59.813404 by SQLgrey-1.7.5 Received: from globalrelay.com (mail1.globalrelay.com [204.92.49.200]) by postgresql.org (Postfix) with ESMTP id 461792E0388 for ; Wed, 5 Mar 2008 11:09:31 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway Received: from [70.89.200.98] (HELO davedell) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 177330093; Wed, 05 Mar 2008 14:09:29 +0000 From: "Dave Dutcher" To: "'SPMLINGAM'" , References: <15847165.post@talk.nabble.com> Subject: Re: postgresql performance Date: Wed, 5 Mar 2008 08:09:39 -0600 Message-ID: <01b501c87eca$8da00ff0$8e00a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ach+q71F0GwlYzhiR6SuW75mpOxO8wAHSdPQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 In-Reply-To: <15847165.post@talk.nabble.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200803/78 X-Sequence-Number: 29032 > -----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. > I have another one query which will do joins with other > small tables, it takes 47 seconds to give output, the result > has 2 lakhs records. the indexing is not used. I have > created one index with one field ( which i used in this > query, the field value has duplicates also ). You should post which version of Postgresql you are using, your table definition, and the output of EXPLAIN ANALYSE run on your query. If you have a lot of IO wait, you are most likely IO bound. When Postgresql is using a lot of CPU it is likely performing a sort or hashing. Pulling a large number of rows out of an even larger table can be difficult to do extremely quickly, but if you post the EXPLAIN ANALYZE output we would know if things could be improved or not. Dave