D
D
ddddd tttt2018-02-16 13:45:20
MySQL
ddddd tttt, 2018-02-16 13:45:20

How to synchronize client and server databases?

I came up with 2 options:
1) The client sends to the server a list of id lines that need to be deleted and a list of lines available on the client (id, update_id). The response is a list of rows to be added (full data set), a list of row ids to be removed from the client, and a list of row ids to be added to the server.
There is one minus, you must always store on the server the id of the rows that need to be deleted.
2) The second option is the same, but it is not necessary to send from the server a list of id lines that need to be deleted on the client, in response to come the entire list of data that is on the server and the database on the client is completely rewritten?
It is no longer necessary to store a list of id rows to be deleted, but there is more traffic when responding from the server and rewriting the entire database is more expensive.
Is there an option that removes all these shortcomings? Perhaps there is an option how to identify the new device from which the user logged in and when all the user's devices are updated, delete the list of id deleted lines.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander null, 2018-02-16
@snikes

use master-slave or master-master database architecture depends on the task

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question