Re: [HACKERS] Creating temp tables inside read only transactions - Mailing list pgsql-general

From Jeff Davis
Subject Re: [HACKERS] Creating temp tables inside read only transactions
Date
Msg-id 1310102939.3012.177.camel@jdavis
Whole thread Raw
In response to Re: Creating temp tables inside read only transactions  (Darren Duncan <darren@darrenduncan.net>)
Responses Re: [HACKERS] Creating temp tables inside read only transactions
List pgsql-general
On Thu, 2011-07-07 at 20:56 -0700, Darren Duncan wrote:
> > When you create a temporary table, PostgreSQL needs to add rows in
> > pg_class, pg_attribute, and probably other system catalogs. So there are
> > writes, which aren't possible in a read-only transaction. Hence the
> > error. And no, there is no workaround.
>
> That sounds like a deficiency to overcome.
>
> It should be possible for those system catalogs to be virtual, defined like
> union views over similar immutable tables for the read-only database plus
> mutable in-memory ones for the temporary tables.

Ideally, yes, from a logical standpoint there are catalog entries that
are only interesting to one backend.

But that doesn't mean it's easy to do. Remember that catalog lookups
(even though most go through a cache) are a path that is important to
performance. Also, more complex catalog interpretations may introduce
some extra bootstrapping challenges.

> Are there any plans in the works to do this?

I don't think so. It sounds like some fairly major work for a
comparatively minor benefit.

Suggestions welcome, of course, to either make the work look more minor
or the benefits look more major ;)

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Darren Duncan
Date:
Subject: Re: Creating temp tables inside read only transactions
Next
From: Darren Duncan
Date:
Subject: Re: [HACKERS] Creating temp tables inside read only transactions