Received: from candle.pha.pa.us (216-55-132-35.dialup.tnt01.san-diego.abac.net [216.55.132.35]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBH5brm60724 for ; Mon, 17 Dec 2001 00:37:54 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id fBH5bqS06826; Mon, 17 Dec 2001 00:37:52 -0500 (EST) From: Bruce Momjian Message-Id: <200112170537.fBH5bqS06826@candle.pha.pa.us> Subject: Re: temp tables versus the global sql area In-Reply-To: <36AF7A62-F280-11D5-92F7-003065C2A10C@mac.com> "from Terrence Brannon at Dec 16, 2001 03:54:16 pm" To: Terrence Brannon Date: Mon, 17 Dec 2001 00:37:52 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200112/174 X-Sequence-Number: 5997 > In the Momjian book it is stated: > > Temporary tables are ideal for holding intermediate data used by > the current SQL session. For example, suppose you need to do many > SELECTs on the result of a complex query. An efficient strategy > is to execute the complex query once, then store the result in a > temporary table. > > > ...However, my question is doesn't postgresql calculate the cost > of complex queries and store there result in some sort of global > sql area sorted by LRU or cost so that you can simply write > complex queries and take care of automatic caching? Nope. Sorry. Those caches would have to be invalidated if someone made a change to those tables. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026