views:

17

answers:

1

Hey there,

Our organization has a very large database which Replicates to separate global servers.

In our database some tables contain data exclusive to a certain region thus providing privileges to exclusive information to users who are within those regions.

example (

transactions_australia, transactions_dubai

)

Contrary to the regional tables, we have global tables which contain information from all regions in the world.

example (

person, address, contacts

)

The issue we face is that when giving out users privileges to this information we present a security risk we are trying to overcome.

The head programmer suggests that we duplicate data which resides in global tables via queries which can extract only that specific regions data into separate database and preform this duplication every time we need to run reports or extract data.

I do not fully agree with this approach as the time to duplicate records of 11+ tables (which contain hundreds of thousands of records) will take far to long, and also the issue of data integrity and synchronization is to risky.

I am searching for an alternative to this duplication approach.

Is there a way of setting up a conditional replication to certain servers?

For example.

If a person record is updated and that person belongs to the Australia region then the record would be updated on the master server and replication would take place only in the corresponding server.

Or are there alternatives to this?

I have briefly looked into using views however I do not think they will provide that level of extrapolation from the main dataset we are after.

A: 

MySQL offers selective replication, but the smallest level of selection is a table. This is because, for the most part, a table can almost always stand alone from a purely database point-of-view. Trying to limit replication by particular rows would severely compromise data integrity and be a database administration nightmare: MySQL would need more information about the tables' use than it is designed to deal with.

In the chapter on replication in the docs, the system settings are described to control replication of selective tables or databases.

staticsan
We are using Selective Tables in our replications, however we still need to provide this additional layer of extracting regional data from global tables. Which is why the lead programmer suggested that we have a script which fetch's all records from all tables which relate to a certain region. However this is so taxing and time consuming that It is not a viable option.
Adam Sto
Could the global table be re-structured to make it easier for such a script? Could you put triggers on it for updating region-specific tables? A script for copying data around like your lead programmer suggested is not a terrible idea, but it's easy to implement badly. Don't be afraid of trying out a mad idea on the way to some other, viable solution.
staticsan