Re: In memory Database for postgres - Mailing list pgsql-general

From Jeff Davis
Subject Re: In memory Database for postgres
Date
Msg-id 1239655931.28193.10.camel@monkey-cat.sm.truviso.com
Whole thread Raw
In response to Re: In memory Database for postgres  (Emanuel Calvo Franco <postgres.arg@gmail.com>)
List pgsql-general
On Mon, 2009-04-13 at 17:36 -0300, Emanuel Calvo Franco wrote:
> >                Thanks for your reply,but what I am actually looking for is
> > database should be an in-memory database and at the same i want to store
> > that data into disk so that data won't be lost when the system restarts or
> > in case of power failure. Can you guys tell me the procedure how to do this?
> > your help will he greatly appreciated.
> >

If you want the writes to be preserved across shutdown, the writes must
go to disk. If that's too expensive, and you are only concerned about
preserving the writes after a clean shutdown, you can turn off fsync
(but then your data will be corrupt after a crash).

The reads will usually come from memory anyway (as long as you have
enough memory), even if the tables are stored on disk. So what's wrong
with just using normal tables?

> So you can make the tables on memory and with a trigger update on disk...
> you can call this inverted materialized views (because in general you
> update the views on memory but not in the disk).

How does that help? Don't you have the same number of disk writes that
way?

> But there is a problem... if you update on memory and a shutdown
> occurs and the trigger didn't start... you lost this record  :( I must
> say that you
>

Triggers are transactional. Either they all fire, and all the updates
happen, or none do.

Aravind, Scott asked the most important question: what problem are you
trying to solve?

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: In memory Database for postgres
Next
From: Scott Marlowe
Date:
Subject: Re: 'no pg_hba.conf entry for host "[local]", user "postgres", database "postgres"'...