Re: Postgresql Caching

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Anon Mous <soundami(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgresql Caching
Date: 2006-10-15 16:53:19
Message-ID: 20061015165319.GC8186@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

mark(at)mark(dot)mielke(dot)cc wrote:

> Using memcache, I've had problems with consistency brought right to
> the front. Both of these have failed me:
>
> 1) When updating a PostgreSQL record, I invalidate the memcache record.
> If another process comes along in parallel before I commit, notices
> that the memcache record is invalidated, it queries the data from
> SQL, and updates the memcache record back to the old value. :-(
>
> 2) When updating a PostgreSQL record, I updated the memcache record
> to the new value. If another process comes along in parallel before
> I commit, that is still looking at an older view, cross-referencing
> may not work as expected.

Hmm, have you tried having a NOTIFY when the Postgres record is updated,
and having a listener daemon that updates the value when it gets the
notification?

One issue is that if the listener is not running you don't get to
update nor invalidate the record, which would cause consistency problems.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2006-10-15 17:34:21 Re: BUG #2683: spi_exec_query in plperl returns column names which are not marked as UTF8
Previous Message Alvaro Herrera 2006-10-15 16:47:44 Re: more anti-postgresql FUD