Jeff Davis pgsql
Fri Oct 6 14:38:59 PDT 2006
On Fri, 2006-10-06 at 12:01 -0700, snacktime wrote:
> Before I dig in and start learning this beast, I thought I would make

Slony is pretty straightforward as far as replication systems go. There
is a bit of learning but I didn't find it a "beast" myself :)

However, I'm using it in a fairly simple way.

> sure there aren't any obvious reasons why slony wouldn't work for us.
> We keep up to 5000 or so clients per db server, with each client
> having their own set of tables in their own schema.  The tables are
> the same for every client.  Any potential issues with using slony in
> this situation?

That's a lot of schemas and a lot of tables.

Consider doing something like the following:

Have the same set of tables for all 5000 clients. Add a "client_id"
field to each table. For each client, create their own schema, and then
use rules and views inside that schema to make it seem like each client
has their own set of tables.

For instance, one rule for one client (say, client 524) might look
something like:

CREATE VIEW table1 AS SELECT attr1,attr2 FROM allclients.table1 WHERE
client_id=524;
CREATE RULE table1_ins_rule AS ON INSERT TO table1 DO INSTEAD INSERT
INTO allclients.table1(client_id,attr1,attr2) VALUES
(524,NEW.attr1,NEW.attr2);

(essentially, make the view "table1" an updatable view using rules)

Now, you just replicate the one set of tables. It seems much more
maintainable also.

Regards,
	Jeff Davis




More information about the Slony1-general mailing list