Thread: Mapping Database completly into memory

Mapping Database completly into memory

From
Daniel Migowski
Date:
Hallo pgsql-performance,

I just wondered if there is a possibility to map my database running
on a linux system completly into memory and to only use disk
accesses for writes.

I got a nice machine around with 2 gigs of ram, and my database at
the moment uses about 30MB on the disks.

Or does Postgresql do this automtatically, with some cache adjusting
parameters, and after doing a select * from <everything> on my
database?

Thank you and ciao,
 Mig-O



Re: Mapping Database completly into memory

From
"scott.marlowe"
Date:
On Sun, 27 Jul 2003, Daniel Migowski wrote:

> Hallo pgsql-performance,
>
> I just wondered if there is a possibility to map my database running
> on a linux system completly into memory and to only use disk
> accesses for writes.
>
> I got a nice machine around with 2 gigs of ram, and my database at
> the moment uses about 30MB on the disks.
>
> Or does Postgresql do this automtatically, with some cache adjusting
> parameters, and after doing a select * from <everything> on my
> database?

Are you looking at a read only type database thing here?  It's generally
considered bad practice to run databases from memory only, since a loss of
power results in a loss of all data.

Postgresql and whatever OS it runs on can usually cache an entire 30 meg
data set in memory easily.  You'll need to crank up shared buffers a bit
(1000 shared buffers is 8 megs, so 5000 should be enough to cache the
whole thing (~40 megs).  Also, be sure and crank up your
effective_cache_size so the planner knows the kernel has lots of space for
caching data and favors index scans.