Skip site navigation (1) Skip section navigation (2)

Re: PostgreSQL as a local in-memory cache

From: "jgardner(at)jonathangardner(dot)net" <jgardner(at)jonathangardner(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: PostgreSQL as a local in-memory cache
Date: 2010-06-15 16:49:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Jun 15, 8:47 am, Chris Browne <cbbro(dot)(dot)(dot)(at)acm(dot)org> wrote:
> "jgard(dot)(dot)(dot)(at)jonathangardner(dot)net" <jgard(dot)(dot)(dot)(at)jonathangardner(dot)net> writes:
> > My question is how can I configure the database to run as quickly as
> > possible if I don't care about data consistency or durability? That
> > is, the data is updated so often and it can be reproduced fairly
> > rapidly so that if there is a server crash or random particles from
> > space mess up memory we'd just restart the machine and move on.
> For such a scenario, I'd suggest you:
> - Set up a filesystem that is memory-backed.  On Linux, RamFS or TmpFS
>   are reasonable options for this.

I had forgotten about this. I will try this out.

> - The complication would be that your "restart the machine and move
>   on" needs to consist of quite a few steps:
>   - recreating the filesystem
>   - fixing permissions as needed
>   - running initdb to set up new PG instance
>   - automating any needful fiddling with postgresql.conf, pg_hba.conf
>   - starting up that PG instance
>   - creating users, databases, schemas, ...

I'm going to have a system in place to create these databases when I
restart the service.

> ...
> I wonder if this kind of installation "comes into its own" for more
> realistic scenarios in the presence of streaming replication.  If you
> know the WAL files have gotten to disk on another server, that's a
> pretty good guarantee :-).

I have found that pre-computing and storing values in a general
relational-type database without durability is an ideal use case to
help improve services that need to return calculated results quickly.
A simple hash lookup is no longer sufficient. Perhaps PostgreSQL
running in this mode will be the ideal solution.

Nowadays, no one is really surprised that it takes 30 seconds or so to
replicate your data everywhere, but they do detest not getting answers
to their complicated queries immediately.

In response to

pgsql-performance by date

Next:From: Craig JamesDate: 2010-06-15 17:12:38
Subject: Re: PostgreSQL as a local in-memory cache
Previous:From: Steve WamplerDate: 2010-06-15 16:02:31
Subject: Re: PostgreSQL as a local in-memory cache

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group