Andrew Sullivan ajs at crankycanuck.ca
Thu Apr 23 07:19:13 PDT 2009
On Thu, Apr 23, 2009 at 10:13:41AM -0400, Geoffrey wrote:
> So, the solution to this is, I assume 'execute script?'

Well, maybe.  The point of truncating is usually to do something fast,
cheap, and easy.  EXECUTE SCRIPT entails a heavyweight lock.  Often,
there _is_ no real way to do this easily.

Since the table is guaranteed to be empty after a truncate, of course,
you can just take it out of replication, truncate it, and re-add it:
the latter should be very fast on an empty table.  It's still a
locking operation, though.

If you have a table you want to truncate a lot, the better bet is to
use inheritance and a couple different underlying tables, so that you
have a table that is guaranteed "out of service" on all nodes.  Then
you can truncate that table everywhere without fear.  This is a loaded
foot-gun, however, so be careful.

> Also, what is the best way to get these tables back in sync without  
> trashing slony and starting over?
>
> Can we drop the tables from replication and re-add them?

Yes.

A

-- 
Andrew Sullivan
ajs at crankycanuck.ca


More information about the Slony1-general mailing list