Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B92542E0092 for ; Wed, 26 Mar 2008 20:49:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 50101-09 for ; Wed, 26 Mar 2008 20:48:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.231]) by postgresql.org (Postfix) with ESMTP id 1C9022E008E for ; Wed, 26 Mar 2008 20:48:58 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 76so3404214wra.10 for ; Wed, 26 Mar 2008 16:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=RWwlqzsEPSKGuZbS+1teP3iRLHjhR3AdRllIPqsC8j4=; b=SYnjEKSnINm2EYiM9lsZh6KdOk319vhAjlpZ+PLx5zYUpuBx0sfWvSmIL2O+gQHv8sUANmNej/hsJhsy45wvkPmFF5ffZX5SbNaImtQgLL4z7LBmbgjUyADSQWpf8J/fQbbtw9DoRowyXv2l0uinbmUagbXS25lV3B7tYts8DC8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Okoqu5Qr4n4m93WL6fAVMyUYHMl3aJGVCNZoJ+ZRoyOZF9BzAff6teUHHS21ABQoBJXHYhucel3BLWUgvs7yKtEanNz1J0Y5tBNFrZWx+CKmP+o2B0tTT+c5DytlEmOw3BnOS4x+RtjyORfzF14VorEAfwfpffRDLFLf1O1pSPw= Received: by 10.140.187.10 with SMTP id k10mr600681rvf.95.1206575336342; Wed, 26 Mar 2008 16:48:56 -0700 (PDT) Received: by 10.140.139.18 with HTTP; Wed, 26 Mar 2008 16:48:56 -0700 (PDT) Message-ID: <4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.com> Date: Wed, 26 Mar 2008 18:48:56 -0500 From: "Peter Koczan" To: "sathiya psql" Subject: Re: postgresql is slow with larger table even it is in RAM Cc: pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/497 X-Sequence-Number: 29451 On Tue, Mar 25, 2008 at 3:35 AM, sathiya psql wrote: > Dear Friends, > I have a table with 32 lakh record in it. Table size is nearly 700 MB, > and my machine had a 1 GB + 256 MB RAM, i had created the table space in > RAM, and then created this table in this RAM. > > So now everything is in RAM, if i do a count(*) on this table it returns > 327600 in 3 seconds, why it is taking 3 seconds ????? because am sure that > no Disk I/O is happening. ( using vmstat i had confirmed, no disk I/O is > happening, swap is also not used ) > > Any Idea on this ??? > > I searched a lot in newsgroups ... can't find relevant things.... ( because > everywhere they are speaking about disk access speed, here i don't want to > worry about disk access ) > > If required i will give more information on this. Two things: - Are you VACUUM'ing regularly? It could be that you have a lot of dead rows and the table is spread out over a lot of pages of mostly dead space. That would cause *very* slow seq scans. - What is your shared_buffers set to? If it's really low then postgres could be constantly swapping from ram-disk to memory. Not much would be cached, and performance would suffer. FWIW, I did a select count(*) on a table with just over 300000 rows, and it only took 0.28 sec. Peter