Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A7FC22E003B for ; Tue, 25 Mar 2008 10:10:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 78581-01 for ; Tue, 25 Mar 2008 10:10:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by postgresql.org (Postfix) with ESMTP id 9CC662E0043 for ; Tue, 25 Mar 2008 10:10:44 -0300 (ADT) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (vanquish.ws.pitbpa0.priv.collaborativefusion.com [192.168.2.162]) (SSL: TLSv1/SSLv3,256bits,AES256-SHA) by wingspan with esmtp; Tue, 25 Mar 2008 09:10:44 -0400 id 00056413.47E8F9D5.0000F450 Date: Tue, 25 Mar 2008 09:10:46 -0400 From: Bill Moran To: "sathiya psql" Cc: pgsql-performance@postgresql.org Subject: Re: postgresql is slow with larger table even it is in RAM Message-Id: <20080325091046.b5d50a35.wmoran@collaborativefusion.com> In-Reply-To: References: Organization: Collaborative Fusion X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.8; i386-portbld-freebsd6.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/472 X-Sequence-Number: 29426 In response to "sathiya psql" : > 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 ??? Yes. It takes your hardware about 3 seconds to read through 700M of ram. Keep in mind that you're not just reading RAM. You're pushing system requests through the VFS layer of your operating system, which is treating the RAM like a disk (with cylinder groups and inodes and blocks, etc) so you have all that processing overhead as well. What filesystem did you format the RAM disk with? Why are you doing this? If you have enough RAM to store the table, why not just allocate it to shared buffers? -- Bill Moran Collaborative Fusion Inc. http://people.collaborativefusion.com/~wmoran/ wmoran@collaborativefusion.com Phone: 412-422-3463x4023