Christopher Browne cbbrowne at ca.afilias.info
Wed Sep 30 08:11:10 PDT 2009
Tatsuo Ishii wrote:
> Hi,
>
> In my understanding, Slony-I does not allow to create/modify temp
> tables on slaves. Does anybody know the reason for this?
>   
Temporary tables are localized to a single connection, and are dropped 
upon closing that connection, so they're not sufficiently persistent to 
be of much use as a major participant in replication.

The only case where I'd expect to be creating temp tables on a 
subscriber is if I put a trigger on the subscriber that does some work 
involving a temp table.

I have never actually tried this, but I don't see why the following 
wouldn't work:

- A trigger function is put on a replicated table, and configured to be 
fired on the subscriber.

- This trigger function is smart enough to...
  - Create a temp table, if it's not there
  - Insert tuples into the temp table
  - Presumably, it should be prepared to immediately do whatever 
processing needs to be done on the temporary data, because you don't 
know for sure when the data will disappear

That last bit is the reason why I would expect temporary tables to be 
nearly useless; the table can't be expected to survive past "when this 
present trigger is firing."  It *MIGHT* survive longer, but you can't 
depend on that.  You can be certain that no other connection will be 
accessing the data placed in the temp table.

Thus, the usefulness is so limited that I'd be inclined to call temp 
tables "useless" in this context.


More information about the Slony1-general mailing list