Re: Traffic jams in fn_extra - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Traffic jams in fn_extra
Date
Msg-id CA+U5nMKmznXz5bfFKouEMG0u8b4UkETpYH4wHbH-3CG-ck98Rg@mail.gmail.com
Whole thread Raw
In response to Re: Traffic jams in fn_extra  (Paul Ramsey <pramsey@cleverelephant.ca>)
Responses Re: Traffic jams in fn_extra  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 24 November 2013 16:02, Paul Ramsey <pramsey@cleverelephant.ca> 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 contexts as children of other contexts, so for
example you might create "PostGIS Cache Context" as a sub-context of
TopTransactionContext. So it can be created dynamically as needed and
will automatically go away at end of xact.

Or you could use CurTransactionContext if you want to do things at
subtransaction level.

This is all used very heavily within Postgres itself, including the
various caches in different parts of the code.

Obviously, if you start cacheing too much then people will claim that
PostGIS is leaking memory, so it depends how far you go. But then you
might alleviate that with a postgis.session_cache parameter to
acknowledge and allow control.

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: review: create if not exists
Next
From: J Smith
Date:
Subject: Re: Errors on missing pg_subtrans/ files with 9.3