php - Synchronize data between two tables
天蓬老师
天蓬老师 2017-07-03 11:40:18
0
1
885

Table A and Table B (Table B wants to synchronize the data in Table A. The account field in Table A is the same as the account field in Table B. The condition for synchronization is that the account field exists in Table A but not in Table B. time, you need to take out the account field in table A and write it to table B synchronously) Please share a good solution for the situation where the amount of data is large and growing

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
扔个三星炸死你

1. Option 1: When there is an operation of writing to table A, the writing operation of table B is also performed immediately.

add(data){
    insertA(data);
    insertB(data);
}

2. Option 2: When there is an operation to write to table A, write the record to the queue and write it to table B asynchronously.

add(data){
    insertA(data);
    synQueue2B(data);
}

In addition, both solutions can write another job to regularly compare the set of account fields in tables A and B for data synchronization

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template