Re: [HACKERS] Traffic jams in fn_extra

2013-11-27 Thread Greg Stark
On Sun, Nov 24, 2013 at 4:21 PM, Simon Riggs wrote: > Why do you need to do this dance with fn_extra? > > It's possible to allocate a hash table in a Transaction-lifetime > memory context on first call into a function then cache things there. > fn_extra gives a handle per function call site. It

Re: [HACKERS] Traffic jams in fn_extra

2013-11-26 Thread Paul Ramsey
On Sunday, November 24, 2013 at 4:42 PM, Tom Lane wrote: > The real question of course is whether transaction-level caching is > appropriate for what they're storing. If they want only statement-level > caching then using fn_extra is often the right thing. I'm not certain it is... we get some grea

Re: [HACKERS] Traffic jams in fn_extra

2013-11-24 Thread Tom Lane
Simon Riggs writes: > On 24 November 2013 16:02, Paul Ramsey wrote: >> We do the dance because it’s how we always have and don’t know any other >> way, any better way. :) The usual explanation. Is there any place you can >> point to that demonstrates your technique? > src/backend/utils/mmgr/RE

Re: [HACKERS] Traffic jams in fn_extra

2013-11-24 Thread Simon Riggs
On 24 November 2013 16:02, Paul Ramsey wrote: > We do the dance because it’s how we always have and don’t know any other way, > any better way. :) The usual explanation. Is there any place you can point to > that demonstrates your technique? src/backend/utils/mmgr/README You can create memory

Re: [HACKERS] Traffic jams in fn_extra

2013-11-24 Thread Paul Ramsey
Hi Simon, We do the dance because it’s how we always have and don’t know any other way, any better way. :) The usual explanation. Is there any place you can point to that demonstrates your technique? Thanks! P -- Paul Ramsey http://cleverelephant.ca/ http://postgis.net/ On Sunday, Novem

Re: [HACKERS] Traffic jams in fn_extra

2013-11-24 Thread Simon Riggs
On 19 November 2013 23:08, Paul Ramsey wrote: > On the solution, I wasn't suggesting another void* slot, but rather a > slot that holds a hash table, so that an arbitrary number of things > can be stuffed in. Overkill, really, since in 99.9% of times only one > thing would be in there, and in the

Re: [HACKERS] Traffic jams in fn_extra

2013-11-19 Thread Paul Ramsey
On Tue, Nov 19, 2013 at 7:32 PM, Tom Lane wrote: > Paul Ramsey writes: >> As we've added different kinds of caching, in our own project, we've banged >> up against problems of multiple functions trying to stuff information into >> the same pointer, and ended up putting an extra container of our

Re: [HACKERS] Traffic jams in fn_extra

2013-11-19 Thread Tom Lane
Paul Ramsey writes: > As we've added different kinds of caching, in our own project, we've banged > up against problems of multiple functions trying to stuff information into > the same pointer, and ended up putting an extra container of our own into > fn_extra, to hold the different kinds of s

[HACKERS] Traffic jams in fn_extra

2013-11-19 Thread Paul Ramsey
As an extension with a lot of CPU load, we (postgis) tend to use flinfo->fn_extra a lot, for caching things that are intensive to calculate at the start of a query and reuse throughout subsequent functions calls. - coordinate projection objects - indexes of the edges of large geometries - other