Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Statement based replication#

Sumit Rawal answered on June 1, 2023 Popularity 2/10 Helpfulness 1/10

Contents


More Related Answers

  • Database replication
  • Data Replication:
  • Logical or row-based replication#
  • Trigger-based replication#

  • Statement based replication#

    0

    Relational databases such as MySQL or Oracle have associated database query languages such as SQL. These languages consist of statements that read, write or modify records within the database. One of the way to maintain a replication log on the master node is to simply record every statement e.g. INSERT, UPDATE or DELETE that is received from clients. Note, we don’t need to record statements that perform reads since they don’t mutate the database. The logged SQL statements can then be sent to the followers who execute these statements on the replica of data they hold to get in sync with the data on the master.

    Problems

    This replication may sound simple and effective but it comes with its own set of problems. Some of these are:

    The SQL statements can consist of non-deterministic functions such as NOW() which returns the current time or RAND() which returns a random number. These functions are likely to evaluate to different values on different nodes. This issue can be overcome by having the master replace the call to the non-deterministic function with a fixed value and then passing the statement to its followers.

    If a SQL statement involves an auto incrementing column or depends on data already present in the database then it must be executed in the same order as it was executed on the master. This can restrict execution of multiple transactions at the same time (concurrently) on the system.

    Database constructs such as triggers, stored procedures, or user-defined functions can have different outcomes when executed on each of the follower nodes. Care must be taken to ensure that statements with side effects are deterministic.

    Popularity 2/10 Helpfulness 1/10 Language sql
    Source: Grepper
    Tags: sql
    Link to this answer
    Share Copy Link
    Contributed on Jun 22 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0

    Relational databases such as MySQL or Oracle have associated database query languages such as SQL. These languages consist of statements that read, write or modify records within the database. One of the way to maintain a replication log on the master node is to simply record every statement e.g. INSERT, UPDATE or DELETE that is received from clients. Note, we don’t need to record statements that perform reads since they don’t mutate the database. The logged SQL statements can then be sent to the followers who execute these statements on the replica of data they hold to get in sync with the data on the master.

    Popularity 2/10 Helpfulness 1/10 Language sql
    Source: Grepper
    Tags: sql
    Link to this answer
    Share Copy Link
    Contributed on Jun 01 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.