pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Uwe C. Schroeder <uwe@oss4u.com>
To: pgsql-admin@postgresql.org
Cc: sathiya psql <sathiya.psql@gmail.com>
Subject: Re: postgresql is slow with larger table even it is in RAM
Date: Tue, 25 Mar 2008 00:42:14 -0800
Message-ID: <200803250142.14715.uwe@oss4u.com> (raw)
In-Reply-To: <f966c2ee0803250136j2b44a10j4fb54afbee3ed8ed@mail.gmail.com>
References: <f966c2ee0803250136j2b44a10j4fb54afbee3ed8ed@mail.gmail.com>


On Tuesday 25 March 2008, 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.


I can't really say anything about your RAM issue, but count(*) is always a bad 
idea if it can be avoided. Assuming you have a primary key on the table, do a 
count(pk). In my experience that alone cuts down up to 30% of execution time.

	Uwe





view thread (8+ messages)  latest in thread

Message-ID: <200803250142.14715.uwe@oss4u.com>
Permalink:  ../200803250142.14715.uwe@oss4u.com/
Also on:    postgresql.org/message-id/200803250142.14715.uwe@oss4u.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: uwe@oss4u.com, sathiya.psql@gmail.com
  Subject: Re: postgresql is slow with larger table even it is in RAM
  In-Reply-To: <200803250142.14715.uwe@oss4u.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox