Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id EEFF09FB53D for ; Wed, 24 Jan 2007 06:19:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 03643-09 for ; Wed, 24 Jan 2007 06:19:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.227]) by postgresql.org (Postfix) with ESMTP id A11E69FB2DA for ; Wed, 24 Jan 2007 06:19:24 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id i11so118991nzh for ; Wed, 24 Jan 2007 02:19:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=IWrFfOFtAeX17r7xpXW3stGTibx3K+YZy3rBJTDZ3kU5RAEm2QgILjFmez6i33WwA+dyyaXY63c1QP/Q5OMf+SW4KGaQmyRg+yspd/BPcm+/1hE3/x7ZhOkefMejzrvCGYmIDGph76ZC1M7nOHHa2ehWWZjhHOFZnNFbnROmOP0= Received: by 10.65.219.3 with SMTP id w3mr776315qbq.1169633962901; Wed, 24 Jan 2007 02:19:22 -0800 (PST) Received: by 10.65.188.5 with HTTP; Wed, 24 Jan 2007 02:19:22 -0800 (PST) Message-ID: Date: Wed, 24 Jan 2007 15:19:22 +0500 From: "Shoaib Mir" To: "Bruno Wolff III" , "Laurent Manchon" , pgsql-performance@postgresql.org Subject: Re: slow result In-Reply-To: <20070123175951.GC20870@wolff.to> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1731_23910764.1169633962580" References: <5.0.2.1.2.20070123113422.00d189e8@pop.univ-montp2.fr> <20070123175951.GC20870@wolff.to> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/364 X-Sequence-Number: 22965 ------=_Part_1731_23910764.1169633962580 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline You can also try this one: ANALYZE tablename; select reltuples from pg_class where relname = 'tablename'; Will also give almost the same results I guess... ------------- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/23/07, Bruno Wolff III wrote: > > On Tue, Jan 23, 2007 at 11:34:52 +0100, > Laurent Manchon wrote: > > Hi, > > > > I have a slow response of my PostgreSQL database 7.4 using this query > below > > on a table with 800000 rows: > > > > select count(*)from tbl; > > > > PostgreSQL return result in 28 sec every time. > > although MS-SQL return result in 0.02 sec every time. > > Besides the other advice mentioned in this thread, check that you don't > have a lot of dead tuples in that table. 28 seconds seems a bit high > for even a sequential scan of 800000 tuples unless they are pretty large. > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ------=_Part_1731_23910764.1169633962580 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline You can also try this one:

ANALYZE tablename;
select reltuples from pg_class where relname = 'tablename';

Will also give almost the same results I guess...

-------------
Shoaib Mir
EnterpriseDB ( www.enterprisedb.com)

On 1/23/07, Bruno Wolff III <bruno@wolff.to> wrote:
On Tue, Jan 23, 2007 at 11:34:52 +0100,
  Laurent Manchon < lmanchon@univ-montp2.fr> wrote:
> Hi,
>
> I have a slow response of my PostgreSQL database 7.4 using this query below
> on a table with 800000 rows:
>
> select count(*)from tbl;
>
> PostgreSQL return result in 28 sec every time.
> although MS-SQL return result in 0.02 sec every time.

Besides the other advice mentioned in this thread, check that you don't
have a lot of dead tuples in that table. 28 seconds seems a bit high
for even a sequential scan of 800000 tuples unless they are pretty large.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

------=_Part_1731_23910764.1169633962580--