Re: Temporary tables under hot standby

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Temporary tables under hot standby
Date: 2012-04-25 23:15:19
Message-ID: CAJKUy5jhW-oZPYLy=v6v=Jt9i3gmY-ku+2v73xOL5JHztfpAEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 25, 2012 at 5:46 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
> I don't know how GTT play inside the Oracle stack such that they
> aren't super popular, but if they work in the standby they will
> quickly become a killer feature.  IMNSHO it's annoying but acceptable
> to be forced to define them into the permanent schema.  Lack of temp
> tables on the standby is a popular question/complaint on irc and in
> most cases the proposal would satisfactorily address the problem.
>

The problem with using GTT for this is, IMHO, that you need to know
what your temp table will look before hand.

I have seen applications that uses the same name (ie: temp1, t1, tt or
t_temp) for all or almost all temp tables and, of course, all those
have different structures.

I have seen also temp tables created dinamically based in a query
(which has more or less columns based on some criteria).

In any case, this means for being able to use GTT on HS for these
applications, the apps needs to be fixed to ensure all temp tables
have different names through the app, also you need to ensure that all
queries that create temp tables to have a fixed set of columns.

Finally, you will need to modify apps to remove all CREATE TEMP TABLE
because they already exists. And i have not mentioned the problem i
will have if i need different behaviour for ON COMMIT (oh! i just did)

so yes, you can workaround things to make this something usable to fix
the problem of "temp tables in HS" but is not transparent (unless you
come from oracle, most db's uses local temp tables just as postgres
does) and certainly is not an ideal solution... FWIW, no one that i
know will want to do those "fixes" in their app.

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jameison Martin 2012-04-26 00:35:37 Re: patch submission: truncate trailing nulls from heap rows to reduce the size of the null bitmap
Previous Message Merlin Moncure 2012-04-25 22:46:33 Re: Temporary tables under hot standby