Synchronizing a SQLite database with a MySQL database using JSON is a common practice and can be an efficient way to transfer data between the two systems. However, the size of the JSON data returned in each request is a concern, as you mentioned.
A large JSON response can cause memory issues and slow down the synchronization process. In this case, it might be more efficient to exchange raw SQL statements between the two systems.
With raw SQL, you can write SQL statements to insert, update, or delete data in the MySQL database, and the statements will be executed directly on the database. This can be faster and more memory-efficient than exchanging data in the form of JSON.
However, raw SQL has some security risks, such as SQL injection attacks. You will need to make sure to properly validate and sanitize the SQL statements before executing them on the database.
In conclusion, it depends on the size of the data and the specific requirements of your use case. You can consider using raw SQL if you need a more efficient and memory-friendly solution. However, be sure to consider the security risks involved and take the necessary precautions to protect your database.