Re: [HACKERS] Creating temp tables inside read only transactions

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Darren Duncan <darren(at)darrenduncan(dot)net>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, mike beeper <mbeeper(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Creating temp tables inside read only transactions
Date: 2011-07-08 05:28:59
Message-ID: 1310102939.3012.177.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Duncan 2011-07-08 06:21:04 Re: [HACKERS] Creating temp tables inside read only transactions
Previous Message Darren Duncan 2011-07-08 03:56:34 Re: Creating temp tables inside read only transactions

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2011-07-08 05:45:49 Re: dropping table in testcase alter_table.sql
Previous Message Jeff Davis 2011-07-08 04:58:20 Re: Extra check in 9.0 exclusion constraint unintended consequences