pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Koczan <pjkoczan@gmail.com>
To: sathiya psql <sathiya.psql@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: postgresql is slow with larger table even it is in RAM
Date: Wed, 26 Mar 2008 18:48:56 -0500
Message-ID: <4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.com> (raw)
In-Reply-To: <f966c2ee0803250135h57ba1d5bs41f77616ae7186dc@mail.gmail.com>
References: <f966c2ee0803250135h57ba1d5bs41f77616ae7186dc@mail.gmail.com>

On Tue, Mar 25, 2008 at 3:35 AM, sathiya psql <sathiya.psql@gmail.com> 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



view thread (13+ messages)  latest in thread

Message-ID: <4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.com>
Permalink:  ../4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.com/
Also on:    postgresql.org/message-id/4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: pjkoczan@gmail.com, sathiya.psql@gmail.com
  Subject: Re: postgresql is slow with larger table even it is in RAM
  In-Reply-To: <4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.com>
  References: <f966c2ee0803250135h57ba1d5bs41f77616ae7186dc@mail.gmail.com> <4544e0330803261648l6b299d0ckc938f44a822d4d0e@mail.gmail.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