Dan Wright wright
Fri Jul 23 01:56:46 PDT 2004
Maybe I mis-understood your original request.  But here is an example of what I
was talking about..

Suppose you have a table called "people", and you want all of the male rows to
replicate onto one server, and all of the female rows to replicate onto another
server.

One way to do this would be to use inheritance.  Make two tables: "male", and
"female" that inherit from "people".  Any time you insert a row into people, you
use a trigger or other mechanism to really insert it into the male or female
table.

Now, you have your people split out, but "select * from people" still does the
right thing.  Once you have that, you can set up slony to replicate the male
table onto one server and the female table onto another server.

Apologies if that isn't what you were asking for.

Daniel J. Wright                           wright at pair.com
Lead Software Developer, pairNIC   https://www.pairnic.com
pair Networks, Inc.                    http://www.pair.com

On Thu, 22 Jul 2004, David Parker wrote:

> How does table inheritance help me to populate tables on another host? I have,
> say, one master and 3 slaves, all with the same schema, but table A in each
> slave as a sub-set of the data in table A on the master.
>  I was thinking maybe of defining a view, A, across tables like host1_A,
> host2_A, etc., then defining a rule to map updates to the appropriate table,
> then allow replication to work from that point on. But I still have the
> question of naming on each host (though I guess I could use the same view
> scheme on each slave, as well).
>  I'm pretty new to postgres, so there may well be an aspect of table
> inheritance of which I'm completely ignorant. Did you have a particular
> approach in mind?
>
> Thanks!
>
> - DAP
>
> 	-----Original Message-----
> 	From: Dan Wright [mailto:wright at smx.pair.com]
> 	Sent: Thu 7/22/2004 6:15 PM
> 	To: David Parker
> 	Cc: slony1-general at gborg.postgresql.org
> 	Subject: Re: [Slony1-general] partitioning with replication
>
>
>
>
> 	It sounds like you are doing the kind of thing that table inheritance is
> 	supposed to solve.  If you use inheritance in your DB tables, you could get
> 	exactly what you are asking for from slony right now.
>
> 	-Dan
>
> 	Daniel J. Wright                           wright at pair.com
> 	Lead Software Developer, pairNIC   https://www.pairnic.com
> 	pair Networks, Inc.                    http://www.pair.com
>
> 	On Thu, 22 Jul 2004, David Parker wrote:
>
> 	> In one area of our application, we would like to be able to capture an
> 	> update to a master table, and select the target replication table based
> 	> on some key value in the update data, e.g. "if key_field == A, replicate
> 	> to table X on host A; if key_field == B, replicate to table X on host
> 	> B", etc.
>
>
>


More information about the Slony1-general mailing list