Re: Is there a way to run tables in RAM?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Karen Hill" <karen_hill22(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a way to run tables in RAM?
Date: 2006-07-14 15:29:15
Message-ID: b42b73150607140829i32fe87f1p4cbd80034edd089@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 13 Jul 2006 14:32:42 -0700, Karen Hill <karen_hill22(at)yahoo(dot)com> wrote:
>
> Roy Souther wrote:
> > I would like to know if there is anyway to move a section of some tables
> > into RAM to work on them.
> >
> > I have large table, about 700MB or so and growing. I also have a bizarre
> > collection of queries that run hundreds of queries on a small section of
> > this table. These queries only look at about 100 or so records at a time
> > and they run hundreds of queries on the data looking for patterns. This
> > causes the program to run very slowly because of hard drive access time.
> > Some times it needs to write changes back to the records it is working
> > with.

> If you are using linux, create a ramdisk and then add a Postgresql
> tablespace to that.

I don't think this will help much. While the ramdisk might be better
than the o/s file cache, it just limits the o/s ability to give memory
to other things. Any modern o/s essentially has a giant ram disk that
runs all the time. It dynamically resizes it depending on what is
going on at the time. It is smart enough to keep frequently used
portions of file in ram all the time and less frequently used portions
on disk to free up memory for sorting, etc.

if fast write access is needed (no syncs), just create a temp table.
just let the operating system do it's thing. if the table is
thrashing, you have two choices, optimize the database to be more
cache friendly or buy more ram.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Florian Weimer 2006-07-14 15:31:38 Re: Timestamp vs timestamptz
Previous Message Christian Rengstl 2006-07-14 15:28:15 Antw: Re: Problem with archive_command