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 3AE82329D41 for ; Sun, 3 Oct 2004 14:25: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 57412-01 for ; Sun, 3 Oct 2004 13:24:59 +0000 (GMT) Received: from boutiquenumerique.com (gailleton-2-82-67-9-10.fbx.proxad.net [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 3E141329D3E for ; Sun, 3 Oct 2004 14:24:57 +0100 (BST) Received: (qmail 5333 invoked from network); 3 Oct 2004 15:25:20 +0200 Received: from unknown (HELO musicbox) (192.168.0.2) by gailleton-2-82-67-9-10.fbx.proxad.net with SMTP; 3 Oct 2004 15:25:20 +0200 To: "Postgresql Performance" Subject: Re: Caching of Queries References: <00e801c4a4b6$5526dd30$8300a8c0@solent> <20040930221107.GP1297@decibel.org> <415CEE8E.8060805@ymogen.net> <200410011010.40705.josh@agliodbs.com> Message-ID: Date: Sun, 03 Oct 2004 15:27:46 +0200 From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <200410011010.40705.josh@agliodbs.com> User-Agent: Opera M2/7.53 (Linux, build 737) 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: 200410/24 X-Sequence-Number: 8500 > 1) The materialized data is available in 3 different forms; a list, a > detail > view, and a spreadsheet. Each form as somewhat different columns and > different rules about ordering, which would likely confuse an SQC > planner. > In this implementation, all 3 forms are able to share the same cache. See my proposal to cache function results. You can create a cached function and : SELECT your rows FROM cached_function(parameters) WHERE ... ORDER BY... GROUP BY... will only fetch the function result from the cache, and then the only additional costs are the ORDER and GROUP BY... the query parsing is very simple, it's just a select, and a "cached function scan" I think caching can be made much more powerful if it is made usable like this. I mean, not only cache a query and its result, but being able to use cached queries internally like this and manipulaing them, adds value to the cached data and allows storing less data in the cache because duplicates are avoided. Thus we could use cached results in CHECK() conditions, inside plsql functions, anywhere...