SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Username Replication

    Just a quick question about replication.

    Lets save I have two MySQL servers which need to store the same username=>userID values.

    This means that when the username changes his or her username, then both databases must be in sync.

    I've been performing this operation simply with two queries which update each of the databases with the username change.

    I was thinking would it be more logical to have a replication of the username from one table to the next. Would MySQL be to slow to perform a username update right away? Wouldn't this also mean that the replication would only work if the username table was exactly the same?
    I can't believe I ate the whole thing

  2. #2
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by matsko View Post
    I was thinking would it be more logical to have a replication of the username from one table to the next. Would MySQL be to slow to perform a username update right away?
    Replication is single-threaded (double-threaded, actually, but let's not go into details), so that depends on your application workload.

    Quote Originally Posted by matsko View Post
    Wouldn't this also mean that the replication would only work if the username table was exactly the same?
    MySQL supports both: row-based and statement-based replication setups. With row-based setup, the queries are processed once on the master and then the changed data is replicated from master to slave. With statement-based setup, statements (queries) are sent from master to slave and are processed on both of them. The latter should work with tables, which have different structures.

    However, I would think twice before doing this through replication. What happens if one of the fields in the first database gets renamed, but stays the same on the second one (as databases are unassociated, this is a real scenario)? Replication would become unusable, and you'd have to move back the process to your application.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •