> 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,
Pennsylvania19026