X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84BD23A5116 for ; Mon, 22 Nov 2004 04:29:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66994-03 for ; Mon, 22 Nov 2004 04:29:02 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 6190A3A50C4 for ; Mon, 22 Nov 2004 04:29:01 +0000 (GMT) Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6694457; Sun, 21 Nov 2004 20:30:31 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: memcached and PostgreSQL Date: Sun, 21 Nov 2004 20:27:15 -0800 User-Agent: KMail/1.6.2 Cc: Bruce Momjian References: <200411220415.iAM4Fh908507@candle.pha.pa.us> In-Reply-To: <200411220415.iAM4Fh908507@candle.pha.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200411212027.15554.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/326 X-Sequence-Number: 9280 Bruce, > The big concern I have about memcache is that because it controls > storage external to the database there is no way to guarantee the cache > is consistent with the database. =A0This is similar to sending email in a > trigger or on commit where you can't be certain you send email always > and only on a commit. Well, some things ... ON COMMIT triggers, or messages with NOTIFY, would=20 improve the accuracy by cutting down on cached aborted transactions. =20 However, caching is of necessity imperfect. Caching is a trade-off; great= er=20 access speed vs. perfect consistency (and any durability). There are cas= es=20 where the access speed is more important than the consistency (or the=20 durability). The answer is to use memcached judiciously and be prepared t= o=20 account for minor inconsistencies. =20 =46or that matter, as with other forms of cumulative asynchronous materiali= zed=20 view, it would be advisable to nightly re-build copies of data stored in=20 memcached from scratch during system slow time, assuming that the data in=20 memcached corresponds to a real table. Where memcached does not correspond= =20 to a real table (session keys, for example), it is not a concern at all. =2D-=20 Josh Berkus Aglio Database Solutions San Francisco