Data writing, data reading method, device and equipment
By setting the index of the database data item as the target data identification and compressing it with routing information, the problem of low database storage and query performance in the era of big data is solved, and efficient data management and resource utilization are achieved.
Patent Information
- Application Number
- CN202010061401.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-19
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2040-01-19
AI Technical Summary
In the era of big data, when a database needs to process a large amount of data, the storage and query performance is low, resulting in excessive resource consumption and difficult to effectively manage.
By setting the index of the data item as the target data identification, rather than the original data identification, and using routing information to compress data, we cleverly utilize the repetition rate characteristics of the data to improve the compression rate of the overall data, and combine other compression algorithms to form a superimposed compression effect.
Effectively manage data, improve storage resources and query performance, and significantly improve data storage and query efficiency.
Smart Images

Figure CN113139097B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of databases, and in particular to a method, device and equipment for writing and reading data. Background Art
[0002] In the era of big data, data is an important part of the Internet, and the realization of Internet functions must be based on data. There are many sources of data, such as travel records, consumption records, browsed web pages, sent messages, etc., and there are many types of data, such as text data, image data, music data, sound data, video data, etc. In view of the large amount of data in the era of big data, these data can be stored in databases, so as to realize the relevant functions of the Internet based on these data.
[0003] A database is a software system that stores and manages data according to data structures. It is a long-term, organized, shared, and uniformly managed data collection. A database is an entity, a "warehouse" that can reasonably store data. Users store the data to be managed in this "warehouse". The two concepts of "data" and "library" are combined into a database. A database is a method of data management that can organize data more appropriately, maintain data more conveniently, control data more strictly, and use data more effectively.
[0004] However, the Internet generates a large amount of data every day (such as hundreds of millions of data). When using a database to store this data, the amount of data that needs to be stored is huge. Therefore, if this data cannot be well managed, a large amount of storage resources will be consumed, and the storage performance and query performance will be very low. Summary of the invention
[0005] The present application provides a data writing method, the method comprising:
[0006] Obtaining a data writing request, wherein the data writing request includes an original data identifier;
[0007] Determine the target data table according to the original data identifier and the total number of data tables;
[0008] Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, where the index of the data item is the target data identifier corresponding to the original data identifier;
[0009] The target data identifier is smaller than the original data identifier.
[0010] The present application provides a data writing method, the method comprising:
[0011] Obtaining a data writing request, wherein the data writing request includes an original data identifier;
[0012] Determine a target data table corresponding to the data write request;
[0013] Adding a data item in the target data table according to the data write request, the index of the data item being the target data identifier corresponding to the original data identifier;
[0014] The target data identifier is smaller than the original data identifier.
[0015] The present application provides a data reading method, the method comprising:
[0016] Obtaining a data read request, wherein the data read request includes an original data identifier;
[0017] Determine the target data table according to the original data identifier and the total number of data tables;
[0018] Sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0019] The read data is obtained from the target database.
[0020] The present application provides a data reading method, the method comprising:
[0021] Obtaining a data read request, wherein the data read request includes an original data identifier;
[0022] Determine a target data table corresponding to the data read request;
[0023] Reading data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0024] Send the read data to the proxy server.
[0025] The present application provides a data writing device, the device comprising:
[0026] An acquisition module, used for acquiring a data writing request, wherein the data writing request includes an original data identifier;
[0027] A determination module, used to determine a target data table according to the original data identifier and the total number of data tables;
[0028] A sending module, configured to send the data write request to a target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, wherein the index of the data item is a target data identifier corresponding to the original data identifier;
[0029] The target data identifier is smaller than the original data identifier.
[0030] The present application provides a data reading device, the device comprising:
[0031] An acquisition module, used for acquiring a data reading request, wherein the data reading request includes an original data identifier;
[0032] A determination module, used to determine a target data table according to the original data identifier and the total number of data tables;
[0033] A sending module, configured to send the data reading request to a target database where the target data table is located, so that the target database reads data from the target data table according to a target data identifier corresponding to the original data identifier; the target data identifier is smaller than the original data identifier;
[0034] The receiving module is used to obtain the read data from the target database.
[0035] The present application provides a proxy server, comprising:
[0036] A processor and a machine-readable storage medium, wherein the machine-readable storage medium stores a plurality of computer instructions, and when the processor executes the computer instructions, the processor performs the following processing:
[0037] Obtaining a data writing request, wherein the data writing request includes an original data identifier;
[0038] Determine the target data table according to the original data identifier and the total number of data tables;
[0039] Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0040] Alternatively, obtaining a data reading request, wherein the data reading request includes an original data identifier;
[0041] Determine the target data table according to the original data identifier and the total number of data tables;
[0042] Sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0043] The read data is obtained from the target database.
[0044] Based on the above technical solution, in the embodiment of the present application, the data items of the target data table are indexed by the target data identifier rather than the original data identifier. Since the target data identifier is smaller than the original data identifier, the amount of data in the target data table is reduced, and the routing information (the relationship between the original data identifier and the target data table and the target database) is fully utilized to participate in the compression of the key data (i.e., the original data identifier), thereby improving the compression rate of the overall data, and cleverly utilizing the high repetition rate of the key data to improve the compression rate of the overall data. It can be used in conjunction with other compression algorithms (simultaneously) to form a superimposed compression effect. It can effectively manage data, improve storage resources, and have high storage performance and query performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings of the embodiments of the present application.
[0046] Figure 1 It is a flowchart of a data writing method in one embodiment of the present application;
[0047] Figure 2 It is a flowchart of a data writing method in one embodiment of the present application;
[0048] Figure 3 is a flow chart of a data reading method in one embodiment of the present application;
[0049] Figure 4 is a flow chart of a data reading method in one embodiment of the present application;
[0050] Figure 5A and Figure 5B This is a schematic diagram of an application scenario in one embodiment of the present application;
[0051] Fig. 6A and Figure 6B It is a flowchart of a data writing method in one embodiment of the present application;
[0052] Fig. 7A and Figure 7B is a flow chart of a data reading method in one embodiment of the present application;
[0053] Fig. 8A is a structural schematic diagram of a data writing device in one embodiment of the present application;
[0054] Figure 8B is a structural schematic diagram of a data reading device in one embodiment of the present application;
[0055] Fig. 9 It is a schematic diagram of the structure of a proxy server in one implementation of the present application. DETAILED DESCRIPTION
[0056] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, rather than limiting the present application. The singular forms of "a", "said" and "the" used in the present application and claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items.
[0057] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, in addition, the word "if" used may be interpreted as "at..." or "when..." or "in response to determination".
[0058] Embodiment 1: This embodiment of the present application proposes a data writing method, which can be applied to any type of device without limitation, as long as data writing can be achieved. For example, it can be applied to a proxy server or an application server. Figure 1 FIG. 1 is a flow chart of a method for writing data, the method comprising:
[0059] Step 101: Obtain a data write request, where the data write request includes an original data identifier.
[0060] Step 102: determine the target data table according to the original data identifier and the total number of data tables.
[0061] In a possible implementation, a processing function (such as a hash function, etc.) can be used to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables. Then, the target data table corresponding to the hash value can be determined.
[0062] Step 103, sending a data write request to the target database where the target data table is located, so that the target database adds a data item in the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier, and the target data identifier is smaller than the original data identifier.
[0063] Exemplarily, after obtaining the data write request, the target data identifier corresponding to the original data identifier can also be determined according to the original data identifier and the total number of data tables, and the target data identifier can be sent to the target database. For example, the target data identifier and the data write request can be sent together to the target database, so that the target database can know the target data identifier corresponding to the original data identifier, and then record the index of the data item as the target data identifier corresponding to the original data identifier.
[0064] In a possible implementation, in order to determine the target data table and the target data identifier corresponding to the original data identifier, the following method can be used: a modulo operation can be performed based on the original data identifier and the total number of data tables; the target data identifier corresponding to the original data identifier is determined based on the quotient obtained after the operation; and the target data table corresponding to the original data identifier is determined based on the remainder obtained after the operation.
[0065] Exemplarily, the target database may include: a time series database for storing time series data.
[0066] In one example, the above execution order is just an example given for the convenience of description. In practical applications, the execution order between the steps can also be changed, and there is no limitation on this execution order. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0067] Based on the above technical solution, in the embodiment of the present application, the data items of the target data table are indexed by the target data identifier rather than the original data identifier. Since the target data identifier is smaller than the original data identifier, the amount of data in the target data table is reduced, and the routing information (the relationship between the original data identifier and the target data table and the target database) is fully utilized to participate in the compression of the key data (i.e., the original data identifier), thereby improving the compression rate of the overall data, and cleverly utilizing the high repetition rate of the key data to improve the compression rate of the overall data. It can be used in conjunction with other compression algorithms (simultaneously) to form a superimposed compression effect. It can effectively manage data, improve storage resources, and have high storage performance and query performance.
[0068] Example 2: This application example proposes a data writing method, which can be applied to any type of device without limitation, as long as data writing can be realized. For example, it can be applied to a database (a database is a database server, that is, a server that realizes the data storage function, and a database server can also be called a storage server). For example, for a database, the database can be a time series database for storing time series data. See Figure 2 FIG. 1 is a flow chart of a method for writing data, the method comprising:
[0069] Step 201: Obtain a data write request, where the data write request includes an original data identifier.
[0070] Step 202: determine the target data table corresponding to the data write request.
[0071] In a possible implementation, when the proxy server sends a data write request to the database, the data write request may also include information of a target data table, based on which the database may determine the target data table corresponding to the data write request according to the information of the target data table.
[0072] In another possible implementation, the database may determine the target data table according to the original data identifier and the total number of data tables. For example, a processing function (such as a hash function, etc.) may be used to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables. Then, the target data table corresponding to the hash value may be determined.
[0073] Step 203: Add a data item to the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier; the target data identifier is smaller than the original data identifier.
[0074] In a possible implementation, the target data identifier corresponding to the original data identifier can be obtained from the proxy server. For example, when the proxy server sends a data write request to the database, the data write request can also include the target data identifier corresponding to the original data identifier. Based on this, the database can determine the target data identifier corresponding to the original data identifier, and then record the index of the data item as the target data identifier corresponding to the original data identifier, rather than recording the index as the original data identifier.
[0075] In another possible implementation, the target data identifier corresponding to the original data identifier can be determined based on the original data identifier and the total number of pre-configured data tables (such as the total number of data tables in all databases). For example, a modulo operation can be performed based on the original data identifier and the total number of data tables; and the target data identifier corresponding to the original data identifier can be determined based on the quotient obtained after the operation.
[0076] In one example, the above execution order is just an example given for the convenience of description. In practical applications, the execution order between the steps can also be changed, and there is no limitation on this execution order. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0077] Based on the above technical solution, in the embodiment of the present application, the data items of the target data table are indexed by the target data identifier rather than the original data identifier. Since the target data identifier is smaller than the original data identifier, the amount of data in the target data table is reduced, and the routing information (the relationship between the original data identifier and the target data table and the target database) is fully utilized to participate in the compression of the key data (i.e., the original data identifier), thereby improving the compression rate of the overall data, and cleverly utilizing the high repetition rate of the key data to improve the compression rate of the overall data. It can be used in conjunction with other compression algorithms (simultaneously) to form a superimposed compression effect. It can effectively manage data, improve storage resources, and have high storage performance and query performance.
[0078] Embodiment 3: This embodiment of the present application proposes a data reading method, which can be applied to any type of device without limitation, as long as data reading can be achieved. For example, it can be applied to a proxy server or an application server. Figure 3 FIG. 1 is a flow chart of a data reading method, which includes:
[0079] Step 301: Obtain a data read request, where the data read request includes an original data identifier.
[0080] Step 302: determine the target data table according to the original data identifier and the total number of data tables.
[0081] In a possible implementation, a processing function (such as a hash function, etc.) can be used to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables. Then, the target data table corresponding to the hash value can be determined.
[0082] Step 303, sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier.
[0083] Exemplarily, after obtaining the data read request, the target data identifier corresponding to the original data identifier can also be determined according to the original data identifier and the total number of data tables, and the target data identifier can be sent to the target database. For example, the target data identifier and the data read request can be sent to the target database together, so that the target database can know the target data identifier corresponding to the original data identifier.
[0084] In a possible implementation, in order to determine the target data table and the target data identifier corresponding to the original data identifier, the following method can be used: a modulo operation can be performed based on the original data identifier and the total number of data tables; the target data identifier corresponding to the original data identifier is determined based on the quotient obtained after the operation; and the target data table corresponding to the original data identifier is determined based on the remainder obtained after the operation.
[0085] Step 304: Acquire the read data from the target database.
[0086] Exemplarily, the target database may include: a time series database for storing time series data.
[0087] In one example, the above execution order is just an example given for the convenience of description. In practical applications, the execution order between the steps can also be changed, and there is no limitation on this execution order. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0088] Based on the above technical solution, in the embodiment of the present application, the data items of the target data table are indexed by the target data identifier rather than the original data identifier. Since the target data identifier is smaller than the original data identifier, the amount of data in the target data table is reduced, and the routing information (the relationship between the original data identifier and the target data table and the target database) is fully utilized to participate in the compression of the key data (i.e., the original data identifier), thereby improving the compression rate of the overall data, and cleverly utilizing the high repetition rate of the key data to improve the compression rate of the overall data. It can be used in conjunction with other compression algorithms (simultaneously) to form a superimposed compression effect. It can effectively manage data, improve storage resources, and have high storage performance and query performance.
[0089] Example 4: This application example proposes a data reading method, which can be applied to any type of device without limitation, as long as data reading can be achieved. For example, it can be applied to a database (a database is a database server, that is, a server that implements the data storage function, and a database server can also be called a storage server). For example, for a database, the database can be a time series database for storing time series data. See Figure 4 FIG. 1 is a flow chart of a data reading method, which includes:
[0090] Step 401: Obtain a data read request, where the data read request includes an original data identifier.
[0091] Step 402: determine the target data table corresponding to the data read request.
[0092] In a possible implementation, when the proxy server sends a data read request to the database, the data read request may further include information of a target data table, based on which the database may determine the target data table corresponding to the data read request according to the information of the target data table.
[0093] In another possible implementation, the database may determine the target data table according to the original data identifier and the total number of data tables. For example, a processing function (such as a hash function, etc.) may be used to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables. Then, the target data table corresponding to the hash value may be determined.
[0094] Step 403, reading data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier.
[0095] In a possible implementation, the target data identifier corresponding to the original data identifier can be obtained from the proxy server. For example, when the proxy server sends a data read request to the database, the data read request can also include the target data identifier corresponding to the original data identifier. Based on this, the database can determine the target data identifier corresponding to the original data identifier, and then read the data from the target data table according to the target data identifier, rather than reading the data from the target data table according to the original data identifier.
[0096] In another possible implementation, the target data identifier corresponding to the original data identifier can be determined based on the original data identifier and the total number of pre-configured data tables (such as the total number of data tables in all databases). For example, a modulo operation can be performed based on the original data identifier and the total number of data tables; and the target data identifier corresponding to the original data identifier can be determined based on the quotient obtained after the operation.
[0097] Step 404: Send the read data to the proxy server.
[0098] In one example, the above execution order is just an example given for the convenience of description. In practical applications, the execution order between the steps can also be changed, and there is no limitation on this execution order. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0099] Based on the above technical solution, in the embodiment of the present application, the data items of the target data table are indexed by the target data identifier rather than the original data identifier. Since the target data identifier is smaller than the original data identifier, the amount of data in the target data table is reduced, and the routing information (the relationship between the original data identifier and the target data table and the target database) is fully utilized to participate in the compression of the key data (i.e., the original data identifier), thereby improving the compression rate of the overall data, and cleverly utilizing the high repetition rate of the key data to improve the compression rate of the overall data. It can be used in conjunction with other compression algorithms (simultaneously) to form a superimposed compression effect. It can effectively manage data, improve storage resources, and have high storage performance and query performance.
[0100] The technical solution of the embodiment of the present application is described below in conjunction with specific application scenarios.
[0101] See also Figure 5AAs shown, it is a schematic diagram of the application scenario of the embodiment of the present application. The client can be deployed on a user device (such as a terminal device, a personal computer, a laptop, a smart phone, a tablet computer, etc., without limitation). The application server is a device that provides services to the client. The database is also called a database server, which can also be called a storage server, and is a device that implements data storage and data access functions.
[0102] Exemplarily, a database may include multiple data tables, and store data through these data tables, and there is no restriction on this storage method. The database may be a time series database for storing time series data, or it may be other types of databases, and there is no restriction on the type of the database. Among them, the full name of the time series database is the time series database, which is mainly used to refer to the processing of data with time tags (changing in the order of time, i.e., time serialization), and the data with time tags is also called time series data.
[0103] For example, at least one database may be deployed. Figure 5A As shown in the figure, three databases are deployed as an example. Of course, the number of databases can be more, and there is no limit to this. Each database can include at least one data table. Figure 5A As shown, database 1 includes data table 0, data table 1 and data table 2, database 2 includes data table 3, data table 4 and data table 5, and database 3 includes data table 6 and data table 7. Of course, each database may include more data tables, which is not limited.
[0104] In order to achieve data compression, in this embodiment, a functional module with a proxy function can be additionally deployed, and data writing and reading can be achieved through the functional module. Exemplarily, the functional module can be deployed in an existing device, such as a database, or as an independent device. For the convenience of description, the functional module is used as an independent device as an example, and this device is called a proxy server.
[0105] Proxy is a special network service that allows a network terminal (usually a client) to establish an indirect connection with another network terminal (usually a server) through this service.
[0106] See also Figure 5B The following is a schematic diagram of the application scenario after the proxy server is deployed. Figure 5A In the application scenario shown, a proxy server is deployed between the application server and the database.
[0107] Based on the above application scenarios, the above solution is described below in combination with several specific embodiments.
[0108] Embodiment 5: This embodiment proposes a data writing method, such as Fig. 6A As shown, the method includes:
[0109] Step 601: The client sends a data write request to the application server.
[0110] Step 602: The application server sends a data write request to the proxy server.
[0111] Specifically, the application server may be configured with the address of the proxy server, and based on the address of the proxy server, the application server may send a data write request to the proxy server.
[0112] Step 603: The proxy server receives a data writing request, where the data writing request includes an original data identifier.
[0113] Exemplarily, in order to distinguish data of different users, the data write request may include a data identifier, and the type of the data identifier is not limited as long as the data can be distinguished. For the convenience of distinction, the data identifier in the data write request may be referred to as the original data identifier.
[0114] Step 604: The proxy server determines the target data table corresponding to the original data identifier and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables.
[0115] In a possible implementation, a processing function (such as a hash function, etc.) can be used to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables. Then, the target data table corresponding to the hash value can be determined.
[0116] Among them, since the processing function can make the total number of hash values obtained after the operation the same as the total number of data tables, each hash value can uniquely correspond to a data table, that is, the data table corresponding to each hash value can be determined. Further, for each hash value, only a unique data table corresponding to the hash value will be determined, and multiple data tables corresponding to the hash value will not be determined at the same time.
[0117] Among them, the processing function can be a hash function, and the hash function can make the total number of hash values obtained after the operation the same as the total number of data tables. For example, the hash function can be a remainder hash function, and the remainder of the original data identifier divided by the total number of data tables can be used as the hash value corresponding to the original data identifier. If the hash value is 0, the target data table corresponding to hash value 0 is data table 0; if the hash value is 1, the target data table corresponding to hash value 1 is data table 1, and so on. Of course, the remainder hash function is just an example and there is no limitation to it, as long as the total number of hash values obtained after the operation can be the same as the total number of data tables.
[0118] In one possible implementation, a selection function (such as a hash function, etc.) can be used to operate on the original data identifier and the total number of data tables to obtain a target data identifier corresponding to the original data identifier; the selection function includes: a selection function that can make the target data identifier obtained after the operation smaller than the original data identifier, and there is no restriction on this selection function, as long as the target data identifier is smaller than the original data identifier.
[0119] For example, the selection function can be a hash function. Taking the remainder hash function as an example, the quotient of the original data identifier divided by the total number of data tables can be used as the target data identifier corresponding to the original data identifier. For example, if the quotient of the original data identifier divided by the total number of data tables is 1, then the target data identifier corresponding to the original data identifier is 1; if the quotient of the original data identifier divided by the total number of data tables is 2, then the target data identifier corresponding to the original data identifier is 2, and so on. Of course, the remainder hash function is just an example and there is no limitation to it, as long as it can ensure that the target data identifier is smaller than the original data identifier.
[0120] In the above embodiment, the processing function can be recorded as f1, then table(key)=f1(S,K), table(key) represents the target data table, S represents the original data identifier, and K represents the total number of data tables. That is to say, the original data identifier and the total number of data tables are taken as input, and the target data table can be obtained based on the processing function.
[0121] In the above embodiment, the selection function can be recorded as f2, then id(key)=f2(S,K), id(key) represents the target data identifier, S represents the original data identifier, and K represents the total number of data tables. That is to say, the original data identifier and the total number of data tables are taken as input, and the target data identifier is obtained based on the selection function.
[0122] Exemplarily, in order to determine the target data table and the target data identifier, taking the modulo hash function as an example, a modulo operation can be performed based on the original data identifier and the total number of data tables (i.e., the total number of data tables deployed by all databases); the target data identifier corresponding to the original data identifier is determined based on the quotient obtained after the operation; and the target data table corresponding to the original data identifier is determined based on the remainder obtained after the operation.
[0123] For example, see Figure 5B As shown, the total number of data tables is 8, and the original data identifier can be 0, 1, 2, etc. If the original data identifier is 0, then the remainder operation is performed on 0 / 8, the quotient is 0, and the remainder is 0, so the target data identifier is 0, and the target data table is data table 0; if the original data identifier is 1, then the remainder operation is performed on 1 / 8, the quotient is 0, and the remainder is 1, so the target data identifier is 0, and the target data table is data table 1; if the original data identifier is 7, then the remainder operation is performed on 7 / 8, the quotient is 0, and the remainder is 7, so the target data identifier is 0, and the target data table is data table 7; if the original data identifier is 8, then the remainder operation is performed on 8 / The remainder operation is performed on 8, the quotient is 1, and the remainder is 0, therefore, the target data identifier is 1, and the target data table is data table 0; if the original data identifier is 15, the remainder operation is performed on 15 / 8, the quotient is 1, and the remainder is 7, therefore, the target data identifier is 1, and the target data table is data table 7; if the original data identifier is 16, the remainder operation is performed on 16 / 8, the quotient is 2, and the remainder is 0, therefore, the target data identifier is 2, and the target data table is data table 0; and so on, the processing process of other original data identifiers is not repeated here.
[0124] In summary, if the original data identifier is a value such as 0, 8, 16, 24, 32, etc., the target data table corresponding to these original data identifiers is data table 0. Original data identifier 0 corresponds to target data identifier 0, original data identifier 8 corresponds to target data identifier 1, original data identifier 16 corresponds to target data identifier 2, original data identifier 24 corresponds to target data identifier 3, and so on. Obviously, the target data identifier is smaller than the original data identifier. Moreover, different original data identifiers can correspond to different target data identifiers.
[0125] In addition, if the original data identifier is a value such as 1, 9, 17, 25, 33, etc., the target data table corresponding to these original data identifiers is data table 1. Original data identifier 1 corresponds to target data identifier 0, original data identifier 9 corresponds to target data identifier 1, original data identifier 17 corresponds to target data identifier 2, original data identifier 25 corresponds to target data identifier 3, and so on. Obviously, the target data identifier is smaller than the original data identifier. Moreover, different original data identifiers can correspond to different target data identifiers.
[0126] In addition, if the original data identifier is a value such as 2, 10, 18, 26, 34, etc., the target data table corresponding to these original data identifiers is data table 2. Original data identifier 2 corresponds to target data identifier 0, original data identifier 10 corresponds to target data identifier 1, original data identifier 18 corresponds to target data identifier 2, original data identifier 26 corresponds to target data identifier 3, and so on. Obviously, the target data identifier is smaller than the original data identifier. Moreover, different original data identifiers can correspond to different target data identifiers.
[0127] By analogy, the characteristics of other original data identifiers are similar to those described above and will not be elaborated here.
[0128] Step 605: The proxy server determines the target database where the target data table is located.
[0129] For example, see Figure 5B As shown, database 1 includes data table 0, data table 1 and data table 2, database 2 includes data table 3, data table 4 and data table 5, and database 3 includes data table 6 and data table 7. Based on the above correspondence, the target database where the target data table is located can be determined. For example, if the target data table is data table 1, the target database is determined to be database 1.
[0130] Step 606: The proxy server sends the data write request to the target database.
[0131] Exemplarily, the proxy server may establish a connection (such as a TCP connection) with the target database, and based on the connection, a data write request may be sent to the target database.
[0132] Exemplarily, when the proxy server sends the data write request to the target database, it can send the target data table information, the target data identifier and the data write request together to the target database. For example, the proxy server can add the target data table information and the target data identifier to the data write request and send the modified data write request to the target database.
[0133] Step 607: After receiving the data write request (including the original data identifier), the target database determines the target data table and target data identifier corresponding to the original data identifier.
[0134] Specifically, since the proxy server sends the information of the target data table and the target data identifier to the target database, the target database can determine the target data table and the target data identifier.
[0135] Step 608: The target database adds a data item to the target data table according to the data write request. The index of the data item is the target data identifier corresponding to the original data identifier, and the index of the data item is not the original data identifier. Moreover, the target data identifier may be smaller than the original data identifier.
[0136] For example, see Table 1, which is an example of a target data table. Each table item in the target data table is called a data item, and the data item may include an index (i.e., key) and an attribute value. When adding a data item to the target data table, the index of the data item is the target data identifier, and the attribute value of the data item may be user data, which is parsed from the data write request and is not limited.
[0137] Table 1
[0138] index Property Value 0 User data a0 1 User data a1 … … 1000 User data a1000 … … 8000 User data a8000
[0139] Of course, Table 1 is only an example of a data table, and the content of this data table is not limited.
[0140] Exemplarily, since the target data identifier is smaller than the original data identifier, when the target data identifier is used as the index of the data item, the amount of indexed data can be reduced, thereby achieving a data compression effect.
[0141] For example, assuming that the total number of data tables is 65536 (i.e. 2^16) and the index of the data item is expressed in binary, then assuming that the original data identifier is 65536, if the index of the data item is the original data identifier, it is necessary to store 11111111111111111, that is, 16 bits are consumed to store the original data identifier. However, if the index of the data item is the target data identifier (the quotient of 65536 divided by 65536 is 1), it is only necessary to store 1, that is, 1 bit is consumed to store the target data identifier. Obviously, the number of bits can be significantly saved.
[0142] Exemplarily, when the target database adds a data item to the target data table, it may also use a compression algorithm to compress the data item, thereby further saving storage resources and improving storage performance.
[0143] Data compression refers to reducing the amount of data to reduce storage space, improve its transmission, storage and processing efficiency, or reorganize data according to a certain algorithm to reduce data redundancy and storage space without losing useful information. Data compression includes lossy data compression and lossless data compression.
[0144] For example, the data item may be compressed using a GZIP (GNUzip) data compression algorithm, or a Snappy data compression algorithm. Of course, the above are just two examples, and there is no limitation to this, and any data compression algorithm may be used to compress the data item.
[0145] By compressing data, data can be effectively managed, storage performance and query performance can be improved, and the data storage cost problem caused by the networking of massive IoT devices in IoT scenarios can be solved.
[0146] Embodiment 6: This embodiment proposes a data writing method, such as Figure 6B As shown, the method includes:
[0147] Step 611: The client sends a data write request to the application server.
[0148] Step 612: The application server sends a data write request to the proxy server.
[0149] Step 613: The proxy server receives a data writing request, where the data writing request includes an original data identifier.
[0150] Step 614: The proxy server determines the target data table corresponding to the original data identifier according to the original data identifier and the total number of data tables, and determines the target database where the target data table is located.
[0151] Step 615: The proxy server sends a data write request to the target database.
[0152] Exemplarily, steps 611 to 615 can refer to embodiment 5, which is different from embodiment 5 in that the proxy server does not determine the target data identifier corresponding to the original data identifier. When the proxy server sends the data write request to the target database, it does not send the target data table information and the target data identifier at the same time.
[0153] Step 616: The target database receives a data write request including an original data identifier, and determines the target data table corresponding to the original data identifier and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables.
[0154] The method for the target database to determine the target data table and the target data identifier can be found in Example 5, except that the execution subject is changed from the proxy server to the target database, which will not be described in detail here.
[0155] Step 617, the target database adds a data item in the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier, and the index of the data item is not the original data identifier. Moreover, the target data identifier can be smaller than the original data identifier.
[0156] Embodiment 7: This embodiment proposes a data reading method, such as Fig. 7A As shown, the method includes:
[0157] Step 701: The client sends a data read request to the application server.
[0158] Step 702: The application server sends a data read request to the proxy server.
[0159] Step 703: The proxy server receives a data reading request, where the data reading request includes an original data identifier.
[0160] Step 704: The proxy server determines the target data table corresponding to the original data identifier and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables.
[0161] Step 705: The proxy server determines the target database where the target data table is located.
[0162] Step 706: The proxy server sends the data read request to the target database.
[0163] Exemplarily, when the proxy server sends the data read request to the target database, the proxy server may send the target data table information, the target data identifier and the data read request together to the target database. For example, the proxy server may add the target data table information and the target data identifier to the data read request and send the modified data read request to the target database.
[0164] Step 707: After receiving the data read request (including the original data identifier), the target database determines the target data table and target data identifier corresponding to the original data identifier.
[0165] Specifically, since the proxy server sends the information of the target data table and the target data identifier to the target database, the target database can determine the target data table and the target data identifier.
[0166] Step 708: The target database reads data from the target data table according to the target data identifier.
[0167] Specifically, the target database can query the target data table shown in Table 1 according to the target data identifier to obtain data corresponding to the target data identifier, such as user data a500.
[0168] Step 709: the target database sends the read data to the proxy server, the proxy server sends the data to the application server, and the application server sends the data to the client.
[0169] Embodiment 8: This embodiment proposes a data reading method, such as Figure 7B As shown, the method includes:
[0170] Step 711: The client sends a data read request to the application server.
[0171] Step 712: The application server sends a data read request to the proxy server.
[0172] Step 713: The proxy server receives a data read request, where the data read request includes an original data identifier.
[0173] Step 714: The proxy server determines the target data table corresponding to the original data identifier according to the original data identifier and the total number of data tables, and determines the target database where the target data table is located.
[0174] Step 715: The proxy server sends the data read request to the target database.
[0175] Exemplarily, steps 711 to 715 can refer to Example 7, which is different from Example 7 in that the proxy server does not determine the target data identifier corresponding to the original data identifier. When the proxy server sends the data read request to the target database, it does not send the target data table information and the target data identifier at the same time.
[0176] Step 716: The target database receives a data read request including an original data identifier, and determines the target data table corresponding to the original data identifier and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables.
[0177] The method for the target database to determine the target data table and the target data identifier can be found in Example 5, except that the execution subject is changed from the proxy server to the target database, which will not be described in detail here.
[0178] Step 717: The target database reads data from the target data table according to the target data identifier.
[0179] Step 718: The target database sends the read data to the proxy server, the proxy server sends the data to the application server, and the application server sends the data to the client.
[0180] Embodiment 9: Based on the same application concept as the above method, the embodiment of the present application also provides a data writing device, which is applied to a proxy server, such as Fig. 8A As shown, it is a structural diagram of the device, including:
[0181] An acquisition module 811 is used to acquire a data write request, wherein the data write request includes an original data identifier; a determination module 812 is used to determine a target data table according to the original data identifier and the total number of data tables; a sending module 813 is used to send the data write request to a target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, wherein the index of the data item is the target data identifier corresponding to the original data identifier;
[0182] The target data identifier is smaller than the original data identifier.
[0183] The determining module 812 is further used to determine the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; the sending module 813 is further used to send the target data identifier to the target database.
[0184] When determining the target data table according to the original data identifier and the total number of data tables, the determination module 812 is specifically used to: use a processing function to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables;
[0185] A target data table corresponding to the hash value is determined.
[0186] The determination module 812 is specifically used to: perform a modulo operation based on the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier based on the quotient obtained after the operation; and determine the target data table corresponding to the original data identifier based on the remainder obtained after the operation.
[0187] Embodiment 10: Based on the same application concept as the above method, the embodiment of the present application also provides a data reading device, which is applied to a proxy server, such as Figure 8B As shown, it is a structural diagram of the device, including:
[0188] An acquisition module 821 is used to acquire a data read request, wherein the data read request includes an original data identifier; a determination module 822 is used to determine a target data table based on the original data identifier and the total number of data tables; a sending module 823 is used to send the data read request to a target database where the target data table is located, so that the target database reads data from the target data table according to a target data identifier corresponding to the original data identifier; the target data identifier is smaller than the original data identifier; a receiving module 824 is used to obtain the read data from the target database.
[0189] The determining module 822 is further used to determine the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; the sending module 823 is further used to send the target data identifier to the target database.
[0190] When determining the target data table according to the original data identifier and the total number of data tables, the determination module 822 is specifically used to: use a processing function to calculate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function that can make the total number of hash values obtained after the calculation the same as the total number of data tables;
[0191] A target data table corresponding to the hash value is determined.
[0192] The determination module 822 is specifically used to: perform a modulo operation based on the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier based on the quotient obtained after the operation; and determine the target data table corresponding to the original data identifier based on the remainder obtained after the operation.
[0193] Based on the same application concept as the above method, the embodiment of the present application further provides a proxy server, including: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores a plurality of computer instructions, and the processor performs the following processing when executing the computer instructions:
[0194] Obtaining a data writing request, wherein the data writing request includes an original data identifier;
[0195] Determine the target data table according to the original data identifier and the total number of data tables;
[0196] Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0197] Alternatively, obtaining a data read request, wherein the data read request includes an original data identifier;
[0198] Determine the target data table according to the original data identifier and the total number of data tables;
[0199] Sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0200] The read data is obtained from the target database.
[0201] The present application also provides a machine-readable storage medium, on which a number of computer instructions are stored; when the computer instructions are executed, the following processing is performed:
[0202] Obtaining a data writing request, wherein the data writing request includes an original data identifier;
[0203] Determine the target data table according to the original data identifier and the total number of data tables;
[0204] Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier;
[0205] Alternatively, a data read request is obtained, the data read request including an original data identifier; a target data table is determined based on the original data identifier and the total number of data tables; the data read request is sent to a target database where the target data table is located, so that the target database reads data from the target data table based on a target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier; and the read data is obtained from the target database.
[0206] See also Fig. 9As shown, it is a structural diagram of the proxy server proposed in the embodiment of the present application, and the proxy server 90 may include: a processor 91, a network interface 92, a bus 93, and a memory 94. The memory 94 may be any electronic, magnetic, optical or other physical storage device, and may contain or store information, such as executable instructions, data, etc. For example, the memory 94 may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state hard disk, any type of storage disk (such as optical disk, DVD, etc.).
[0207] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0208] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0209] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0210] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0211] Moreover, these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0212] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0213] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A data writing method, characterized in that: The method comprises: Obtaining a data writing request, wherein the data writing request includes an original data identifier; Determine the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier according to the quotient obtained after the operation; determine the target data table corresponding to the original data identifier according to the remainder obtained after the operation; Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, where the index of the data item is the target data identifier corresponding to the original data identifier; The target data identifier is smaller than the original data identifier.
2. The method according to claim 1, characterized in that After determining the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables, the method further includes: The target data identifier is sent to the target database.
3. The method according to claim 1, characterized in that: The determining of the target data table according to the original data identifier and the total number of data tables also includes: Using a processing function to operate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function capable of making the total number of hash values obtained after the operation the same as the total number of data tables; A target data table corresponding to the hash value is determined.
4. The method according to claim 1 or 2, characterized in that: The target database includes: a time series database for storing time series data.
5. A data writing method, characterized in that: The method comprises: Obtaining a data writing request, wherein the data writing request includes an original data identifier; Determine a target data table corresponding to the data write request, and determine a target data identifier corresponding to the original data identifier; wherein, after performing a remainder operation according to the original data identifier and the total number of data tables, the target data identifier corresponding to the original data identifier is determined according to the quotient obtained after the operation, and the target data table corresponding to the original data identifier is determined according to the remainder obtained after the operation; Adding a data item in the target data table according to the data write request, the index of the data item being the target data identifier corresponding to the original data identifier; The target data identifier is smaller than the original data identifier.
6. The method according to claim 5, characterized in that Before adding a data item to the target data table according to the data write request, the method further includes: Determine the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of pre-configured data tables; or, Obtain a target data identifier corresponding to the original data identifier from the proxy server.
7. A data reading method, characterized in that: The method comprises: Obtaining a data read request, wherein the data read request includes an original data identifier; Determine the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier according to the quotient obtained after the operation; determine the target data table corresponding to the original data identifier according to the remainder obtained after the operation; Sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier; The read data is obtained from the target database.
8. The method according to claim 7, characterized in that After determining the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables, the method further includes: The target data identifier is sent to the target database.
9. The method according to claim 7, characterized in that: The determining of the target data table according to the original data identifier and the total number of data tables also includes: Using a processing function to operate the original data identifier and the total number of data tables to obtain a hash value corresponding to the original data identifier; wherein the processing function includes: a processing function capable of making the total number of hash values obtained after the operation the same as the total number of data tables; A target data table corresponding to the hash value is determined.
10. The method according to claim 7 or 8, characterized in that: The target database includes: a time series database for storing time series data.
11. A data reading method, characterized in that: The method comprises: Obtaining a data read request, wherein the data read request includes an original data identifier; Determine a target data table corresponding to the data read request, and determine a target data identifier corresponding to the original data identifier; wherein, after performing a remainder operation according to the original data identifier and the total number of data tables, the target data identifier corresponding to the original data identifier is determined according to the quotient obtained after the operation, and the target data table corresponding to the original data identifier is determined according to the remainder obtained after the operation; Reading data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier; Send the read data to the proxy server.
12. The method according to claim 11, characterized in that Before reading data from the target data table according to the target data identifier corresponding to the original data identifier, the method further includes: Determine the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of pre-configured data tables; or, Obtain a target data identifier corresponding to the original data identifier from the proxy server.
13. A data writing device, characterized in that: The device comprises: An acquisition module, used for acquiring a data writing request, wherein the data writing request includes an original data identifier; A determination module, used to determine a target data table and a target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; the target data identifier corresponding to the original data identifier is determined according to the quotient obtained after the operation; and the target data table corresponding to the original data identifier is determined according to the remainder obtained after the operation; A sending module, configured to send the data write request to a target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, wherein the index of the data item is a target data identifier corresponding to the original data identifier; The target data identifier is smaller than the original data identifier.
14. A data reading device, characterized in that: The device comprises: An acquisition module, used for acquiring a data reading request, wherein the data reading request includes an original data identifier; A determination module, used to determine a target data table and a target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; the target data identifier corresponding to the original data identifier is determined according to the quotient obtained after the operation; and the target data table corresponding to the original data identifier is determined according to the remainder obtained after the operation; A sending module, configured to send the data reading request to a target database where the target data table is located, so that the target database reads data from the target data table according to a target data identifier corresponding to the original data identifier; the target data identifier is smaller than the original data identifier; The receiving module is used to obtain the read data from the target database.
15. A proxy server, characterized in that: include: A processor and a machine-readable storage medium, wherein the machine-readable storage medium stores a plurality of computer instructions, and when the processor executes the computer instructions, the processor performs the following processing: Obtaining a data writing request, wherein the data writing request includes an original data identifier; Determine the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier according to the quotient obtained after the operation; determine the target data table corresponding to the original data identifier according to the remainder obtained after the operation; Sending the data write request to the target database where the target data table is located, so that the target database adds a data item to the target data table according to the data write request, the index of the data item is the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier; Alternatively, obtaining a data reading request, wherein the data reading request includes an original data identifier; Determine the target data table and the target data identifier corresponding to the original data identifier according to the original data identifier and the total number of data tables; wherein a remainder operation is performed according to the original data identifier and the total number of data tables; determine the target data identifier corresponding to the original data identifier according to the quotient obtained after the operation; determine the target data table corresponding to the original data identifier according to the remainder obtained after the operation; Sending the data read request to the target database where the target data table is located, so that the target database reads data from the target data table according to the target data identifier corresponding to the original data identifier; wherein the target data identifier is smaller than the original data identifier; The read data is obtained from the target database.
