From: | Bexley Hall <bexley401(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Query caching absent "query caching" |
Date: | 2012-11-24 23:04:14 |
Message-ID: | 50B1526E.9020606@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
In the absence of query caching AND NOT WANTING TO FORCE
THE APPLICATION TO DO SO EXPLICITLY, I'm looking for ideas
as to how I should "future-safe" the design of some custom
user base types and functions thereon.
Specifically, I have several computationally expensive
functions that derive their results from specific values of
these base types. *Solely*. (For example, area() when
applied to a given "circle" always yields the same result...
though this is a trivial/inexpensive function, by comparison).
I can define the base types to set aside space to store
these results and cache them *in* the base type. Then, serve
up these cached results when they are needed, again. With
plan caching, this should (?) reduce the cost of repeated
queries significantly without the need/benefit for caching the
actual query results. (Is that true?)
To guard against future enhancements to the server (e.g., if
query caching is ever implemented, etc.), I assume that all
such functions should declare themselves as IMMUTABLE? Or,
does my update of the internal representation of the data
values (i.e., to include the cached results of each of these
functions) conflict with this declaration?
[I am working in a fixed, constrained resource environment so
the idea of explicitly building a temporary table to hold these
results in the absence of a smart query caching strategy is not
possible -- the builder(s) of such tables would have to know
too much about each other to not exhaust the resources available!]
Thanks!
--don
From | Date | Subject | |
---|---|---|---|
Next Message | wd | 2012-11-24 23:44:38 | Re: Restore postgres to specific time |
Previous Message | Gavin Flower | 2012-11-24 22:56:17 | Re: High SYS CPU - need advise |