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 2AF3B329EDF for ; Mon, 27 Sep 2004 14:30:08 +0100 (BST) 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 68022-05 for ; Mon, 27 Sep 2004 13:30:00 +0000 (GMT) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.248]) by svr1.postgresql.org (Postfix) with ESMTP id 99940329E77 for ; Mon, 27 Sep 2004 14:30:02 +0100 (BST) Received: by mproxy.gmail.com with SMTP id u52so231170cwc for ; Mon, 27 Sep 2004 06:29:58 -0700 (PDT) Received: by 10.11.117.26 with SMTP id p26mr12961cwc; Mon, 27 Sep 2004 06:29:58 -0700 (PDT) Received: by 10.11.119.12 with HTTP; Mon, 27 Sep 2004 06:29:58 -0700 (PDT) Message-ID: <330532b6040927062938c1d596@mail.gmail.com> Date: Mon, 27 Sep 2004 09:29:58 -0400 From: Mitch Pirtle Reply-To: Mitch Pirtle To: Tom Lane Subject: Re: Caching of Queries Cc: Neil Conway , Aaron Werman , Scott Kirkwood , pgsql-performance@postgresql.org In-Reply-To: <18766.1096262336@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1096261381.25688.741.camel@localhost.localdomain> <18766.1096262336@sss.pgh.pa.us> 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: 200409/281 X-Sequence-Number: 8409 On Mon, 27 Sep 2004 01:18:56 -0400, Tom Lane wrote: > IIRC, in our past threads on this topic, it was suggested that if you > can tolerate not-necessarily-up-to-date results, you should be doing > this sort of caching on the client side and not in the DB server at all. > I wouldn't try that in a true "client" scenario, but when the DB client > is application-server middleware, it would make some sense to cache in > the application server. I'd also like to add that when one of the Mambo community members started running benchmarks of popular Content Management Systems (CMS), the ones that implemented page-level caching were significantly more scalable as a result of the decreased load on the database (and application server, as a result): http://forum.mamboserver.com/showthread.php?t=11782 Caching at the database level provides the smallest possible performance boost (at least regarding caching), as caching the query on the webserver (via ADOdb's query cache) avoids the database server altogether; and page-level caching gives you the biggest possible benefit. Yes, you have to be careful how you cache your data, but for many applications it is easy to implement a trigger that clears the cache when certain data is updated. -- Mitch