How to create database tables that are caching?

I would like to create a database that is accessed through a very slow network link. And, fortunately, the database itself is pretty static. So I'm going to use aggressive result caching. From time to time, other inserts and updates may occur in the tables while the client is running, so I would like to develop a low-bandwidth system where the client knows exactly when something is updated to avoid even trying to check the remote database.

My idea was to create a special table with two columns, one is the name of the table and the other is the version number. This table will never be directly modified by application requests. It will be updated using the stored procedure. Whenever any table changes, the stored procedure must increase the number of this special table.

The client can then store the results of the queries in a local database (e.g. sqlite) along with the version number of the table. Then the next time you make a selection in a special table and checks if the tables have changed.

How does this sound? Are there other strategies to minimize database overhead and database aggregation? The case will be not only a cross-platform, but also other clients in programming languages ​​who can access it (C, C ++, Obj-C, Python, etc.), so I try to find the simplest thing to work with in all cases.

Ideally, I would like the tables to be incremental (the actual inserts are deleted), so I can just query the highest table identifier and compare with the local one. However, I do not know where to look for examples of this. Reading The CouchDB tech page makes my head explode.

+3
source share
3

, , , , , . , , gzip , . X, , " X"

+1

, . , , ...

, . , ! , , , - ...


, , .. .

. , , : -)


.

, . , :

  • , , , , .
  • , , , , .
0

, 3 4 . ( MySQL ).

You can have slave replication on every site that you need to access the database. And write your client software just to request a local replica. Believe me, it’s much easier to work with databases when you don’t need to re-implement low-level functions such as replication.

0
source

Source: https://habr.com/ru/post/1717662/


All Articles