A data processing method, device, equipment and medium

By introducing key-value databases and inverted index databases into relational databases, and using key-value pair storage and inverted indexes to provide primary key and keyword queries, the problem of inefficient non-index field query performance in relational databases is solved, and rapid Query and data storage reduce the space occupied by indexes and improve query efficiency and data access performance.

CN114969020BActive Publication Date: 2024-10-01DOUYIN VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110202921.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-23
Publication Date
2024-10-01
Estimated Expiration
2041-02-23

AI Technical Summary

Technical Problem

The performance of relational databases is inefficient when querying non-indexed fields, resulting in full table scans, which may lead to system crashes, especially when the amount of user data is large. The existing index optimization effect is not ideal, and the storage space occupied by the index increases and the modification ability is affected.

Method used

Introduce a hybrid storage system, use key-value databases and inverted index databases to cooperate with relational databases, and provide primary key and keyword queries through key-value pair storage and inverted indexes to avoid full table scans and improve query efficiency.

Benefits of technology

It achieves fast query and data storage, reduces the space occupied by indexes, improves query efficiency and data access performance, and reduces ad hoc query delays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969020B_ABST
    Figure CN114969020B_ABST
Patent Text Reader

Abstract

The disclosed embodiments relate to a data processing method, apparatus, device and medium, wherein the method comprises: receiving a data access request; carrying an access field of the data to be accessed in the data access request; when the access field is a first primary key, querying the data corresponding to the first primary key in the key-value database and / or relational database of the hybrid storage system; wherein the hybrid storage system comprises: a relational database, a key-value database and an inverted index database; when the access field is a keyword, querying the second primary key corresponding to the keyword in the inverted index database, and querying the data corresponding to the second primary key in the key-value database and / or relational database; finally responding to the data access request based on the queried data. In the above technical solution, data can be quickly queried based on the primary key, effectively improving the query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data retrieval technology, and in particular to a data processing method, device, equipment and medium. Background Art

[0002] In the business of querying data on relational databases, there are often scenarios where data is queried based on non-index fields. When querying data based on non-index fields, the database needs to perform a full table scan to obtain the query results. Full table scans are very time-consuming and the query performance is very inefficient. As the amount of user data and product data increases, a full table scan query may even lead to catastrophic consequences such as system crashes. At present, although the query efficiency can be improved to a certain extent by establishing relevant indexes in the database, the improvement effect is not ideal. For example, when faced with various ad hoc queries with very flexible user query conditions, relational databases still cannot cope with them. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data processing method, device, equipment and medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a data processing method, comprising: receiving a data access request; wherein the data access request carries an access field of data to be accessed; when the access field is a first primary key, querying the key-value database and / or the relational database of a hybrid storage system for data corresponding to the first primary key; wherein the hybrid storage system comprises: the relational database, the key-value database and an inverted index database; when the access field is a keyword, querying the inverted index database for a second primary key corresponding to the keyword, and querying the key-value database and / or the relational database for data corresponding to the second primary key; and responding to the data access request based on the queried data.

[0005] Optionally, the key-value database and the inverted index database are slave libraries of the relational database; wherein the key-value database is used to store the business data in the relational database as key-value pairs, the primary key in the key-value pair is a field in the business data and is used to identify the business data, and the key value in the key-value pair is the business data identified by the primary key; the inverted index database is used to cache the inverted index, and the inverted index is used to record the entries of the business data in the relational database contained in numbered documents.

[0006] Optionally, querying the data corresponding to the first primary key in the key-value database and / or relational database of the hybrid storage system includes: querying the key value corresponding to the first primary key in the key-value database; if the key value corresponding to the first primary key exists in the key-value database, determining the key value corresponding to the first primary key as the first data; if the key value corresponding to the first primary key does not exist in the key-value database, querying the second data corresponding to the first primary key in the relational database based on the SQL query method.

[0007] Optionally, after querying the relational database for the second data corresponding to the first primary key based on the SQL query method, the method further includes: writing the second data into the key-value database, and packaging the first data and the second data; responding to the data access request based on the queried data includes: using the packaging result of the first data and the second data as the response result of the data access request.

[0008] Optionally, after querying the relational database for second data corresponding to the first primary key based on the SQL query method, the method further includes: using the second data as a key value of the first primary key, and caching it in the key value database.

[0009] Optionally, the method also includes: determining, based on preset resource configuration parameters, the number of the document in the inverted index database as the return result of the inverted index database; querying the second primary key corresponding to the keyword in the inverted index database includes: searching for a target document containing the keyword in the document of the inverted index database, and determining the number of the target document as the second primary key returned to the key-value database.

[0010] Optionally, the method also includes: receiving a data change request; wherein the data change request is a request to add, delete or modify data; changing the data in the relational database according to the data change request, and synchronously calling the key-value database to cache the key-value pairs corresponding to the changed data in the relational data to the key-value database.

[0011] Optionally, the method further includes: generating a change log when the relational database completes the data change; wherein the change log is used to record the changed data in the relational database; and changing the inverted index related to the changed data in the inverted index database by consuming the change log.

[0012] In a second aspect, an embodiment of the present disclosure further provides a data processing device, comprising: a request receiving module, used to receive a data access request; wherein the data access request carries an access field of the data to be accessed; a first query module, used to query the key-value database and / or the relational database of the hybrid storage system for data corresponding to the first primary key when the access field is a first primary key; wherein the hybrid storage system comprises: the relational database, the key-value database and the inverted index database; a second query module, used to query the inverted index database for a second primary key corresponding to the keyword when the access field is a keyword, and query the key-value database and / or the relational database for data corresponding to the second primary key; a response module, used to respond to the data access request based on the queried data.

[0013] An embodiment of the present disclosure also provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the data processing method provided in the first aspect.

[0014] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the data processing method provided in the first aspect.

[0015] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0016] The data processing method, apparatus, device and medium provided by the embodiments of the present disclosure first receive a data access request; when the access field carried in the data access request is a first primary key, query the data corresponding to the first primary key in the key-value database and / or the relational database of the hybrid storage system; wherein the hybrid storage system includes: a relational database, a key-value database and an inverted index database; when the access field is a keyword, query the second primary key corresponding to the keyword in the inverted index database, and query the data corresponding to the second primary key in the key-value database and / or the relational database; finally, respond to the data access request based on the queried data.

[0017] In the above technical scheme, by introducing a key-value database and an inverted index database on the basis of a relational database, it is possible to avoid establishing an index in the relational database, and instead make full use of the storage advantage of the key-value database using key-value pairs, and provide a second primary key corresponding to the keyword through the inverted index database, thereby avoiding full table scanning in the relational database; furthermore, through the superior query performance of the key-value database, data can be quickly queried based on the primary key, effectively improving query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0020] Figure 1 A flowchart of a data processing method provided by an embodiment of the present disclosure;

[0021] Figure 2 A schematic diagram of the architecture of a hybrid storage system provided in an embodiment of the present disclosure;

[0022] Figure 3 An interactive diagram of data access provided by an embodiment of the present disclosure;

[0023] Figure 4 An interactive diagram of data changes provided by an embodiment of the present disclosure;

[0024] Figure 5 A schematic diagram of the structure of a data processing device provided in an embodiment of the present disclosure;

[0025] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0027] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0028] In business scenarios where relational databases such as MySQL query data based on non-indexed fields, data query performance is very inefficient. In order to improve the query performance problem, relevant indexes can be established in the database. However, this method is not ideal for improving query efficiency. More importantly, too many indexes cause the storage space occupied in the relational database to grow exponentially, severely limiting the data storage capacity and affecting the modification ability of the relational database. It can be seen that the existing method of establishing indexes not only fails to effectively improve query performance, but also brings additional problems such as data storage and modification.

[0029] In order to improve at least one of the above problems, the embodiments of the present disclosure provide a data processing method, device, equipment and medium. The technology can be applied to any scenario requiring data query or data retrieval, such as applying it to scenarios such as performing ad hoc queries on MySQL (relational database management system) through electronic devices such as mobile phones and computers. For ease of understanding, the embodiments of the present disclosure are described in detail below.

[0030] Figure 1 The present invention provides a flowchart of a data processing method provided in an embodiment of the present invention. The method can be executed by a data processing device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:

[0031] Step S102, receiving a data access request; wherein the data access request carries an access field of the data to be accessed.

[0032] In this embodiment, the data access request may be a data request initiated by the data access party at the data access device to instruct the data processing device to perform an access operation on the data in the database. The access field carried in the data access request is the field for the data to be accessed input by the data access party when initiating the data access request.

[0033] Typically, data access requests include data access requests for simple primary keys of database tables and data access requests with complex conditions for full-text search. Accordingly, the access fields carried in the data access request may include: a primary key that uniquely identifies the data to be accessed, and keywords customized by the data access party when using ad hoc queries.

[0034] Step S104, when the access field is the first primary key, query the data corresponding to the first primary key in the key-value database and / or relational database of the hybrid storage system; wherein the hybrid storage system includes: a relational database, a key-value database and an inverted index database.

[0035] Reference Figure 2The architecture diagram of the hybrid storage system shown in FIG. 1 shows that the hybrid storage system includes a relational database, a key-value database, and an inverted index database that cooperate with each other; the key-value database and the inverted index database are slave libraries of the relational database. Among them, the key-value database (such as Redis) is used to store the business data in the relational database as key-value pairs. The primary key in the key-value pair is a field in the business data and is used to uniquely identify the business data. The key value is the business data identified by the primary key. A key-value pair in the key-value database corresponds to a piece of business data in the relational database.

[0036] The inverted index database is used to cache the inverted index, and the inverted index is used to record the terms of business data in the relational database contained in the numbered documents; that is, the inverted index is used to record which documents contain a certain term, and the inverted index can be used to quickly find all documents containing the term based on the term.

[0037] For different data access requests initiated by the data access party, there will be certain differences in the query method. In this embodiment, when the access field carried in the data access request is the first primary key, the data corresponding to the first primary key can be queried in the key-value database. If the data cannot be found in the key-value database, it is returned to the source through the relational database, and finally the data queried from the key-value database and the data queried from the relational database are returned to the data access party. In this embodiment, the relational database and the key-value database are coordinated, and there is no need to establish an index in the relational database, which effectively avoids the problem of excessive storage space occupied by the index; at the same time, the key-value database adopts a key-value pair data storage method, which can reach about 500,000 QPS (Query Per Second) in non-hotspot conditions, and the key-value database with superior query performance is used to improve data access efficiency.

[0038] Step S106: when the access field is a keyword, query the second primary key corresponding to the keyword in the inverted index database, and query the data corresponding to the second primary key in the key-value database and / or the relational database.

[0039] In this embodiment, when the access field carried in the data access request is a keyword, the second primary key corresponding to the keyword can be queried in the inverted index database first, and then referring to step S104, the data corresponding to the second primary key can be queried in the key-value database and / or relational database.

[0040] In the prior art, data search based on the inverted index method has a delay of at least 1 second; however, this embodiment introduces a key-value database based on the inverted index database. The inverted index database does not need to perform a time-consuming data search process, but only needs to return the second primary key. By querying the key-value database with superior query performance based on the second key value, the real-time nature of the queried data can be guaranteed.

[0041] Step S108: respond to the data access request based on the queried data.

[0042] Specifically, the data queried from the hybrid storage system is sent to the data access party in response to the data access request.

[0043] In the data processing method provided by the embodiment of the present disclosure, by introducing a key-value database and an inverted index database on the basis of a relational database, it is possible to avoid establishing an index in the relational database, and instead fully utilize the storage advantage of the key-value database using key-value pairs, and provide a second primary key corresponding to the keyword through the inverted index database, thereby avoiding full table scanning in the relational database; further, through the superior query performance of the key-value database, data can be quickly queried based on the first primary key or the second primary key, effectively improving query efficiency.

[0044] For better understanding, this embodiment describes the data processing method provided above in detail.

[0045] In actual applications, a data access request sent by a data access party is generally received through an input interface; the access field carried in the data access request is parsed according to the input interface of the data access request. It should be noted that data access requests carrying different access fields can be input through different interfaces. Accordingly, for data access requests carrying different access fields, different data access methods can be used to obtain the data to be accessed. Figure 3 The data access interaction diagram shown provides a process for implementing data access by cooperation between the key-value database and the relational database when the access field is the first primary key, and a process for implementing data access by cooperation between the inverted index database, the key-value database, and the relational database when the access field is a keyword; the following describes the above two data access processes respectively.

[0046] In one embodiment, the interface for receiving data access requests may be a batch acquisition interface. The data access requests received through the batch acquisition interface carry batch access fields, and each access field is a first primary key. For example, the access field is the student ID of multiple students, and one first primary key corresponds to one student ID. Figure 3This embodiment provides a method for querying data corresponding to a first primary key in a key-value database and / or a relational database, referring to the following steps 1 to 4:

[0047] Step 1: Query the key value corresponding to the first primary key in the key-value database.

[0048] In this embodiment, the relational database assigns a primary key to the business data it stores, and caches the primary key and the business data uniquely identified by the primary key into a key-value database. In the key-value database, each piece of data is stored in a data table according to a key-value pair structure such as a primary key (PrimaryKey) and a key value (Value), and the data recorded in the key-value database is consistent with the corresponding business data in the relational database.

[0049] Step 2: If a key value corresponding to the first primary key exists in the key-value database, the key value corresponding to the first primary key is determined as the first data.

[0050] In the case of batch query, there are multiple first primary keys carried in the data access request; for the key value corresponding to the first primary key that can be queried in the key-value database, the data represented by the key value is determined as the first data; if the key value corresponding to the first primary key cannot be queried in the key-value database, refer to the following step 3.

[0051] Step 3: If the key value corresponding to the first primary key does not exist in the key-value database, query the relational database for the second data corresponding to the first primary key based on the SQL query method.

[0052] For a first primary key whose corresponding key value cannot be found in the key-value database, second data corresponding to the first primary key is searched in the relational database.

[0053] Step 4: write the second data into the key-value database, and package the first data and the second data. Then, use the packaged result of the first data and the second data as the response result of the data access request.

[0054] Furthermore, it is understandable that if all key values ​​corresponding to the first primary key can be found in the key-value database, the first data is directly returned as a response result to the data access request.

[0055] After querying the second data corresponding to the first primary key from the relational database based on the SQL query method, the second data can also be cached in the key-value database as the key value of the first primary key. In this way, when it is necessary to access again, the data corresponding to the first primary key can be directly read from the cache of the key-value database, further improving the data query efficiency.

[0056] The data access method based on the first primary key provided in this embodiment utilizes a key-value database to not only improve data query efficiency, but also caches business data in a relational database by using a key-value pair storage method through the key-value database, which can significantly improve the problem of excessive storage space occupation in the relational database due to the establishment of too many indexes.

[0057] In another embodiment, the interface for receiving data access requests may be a search interface that meets ad hoc query scenarios. In the data access requests received through the search interface, the access fields carried are keywords. For example, if the data to be accessed is the resident information of a certain area, the access fields may be one or more custom keywords such as the area name and gender. Figure 3 This embodiment provides a data access method based on an inverted index database, comprising: firstly, searching the inverted index database for a second primary key corresponding to a keyword; and then referring to steps 1 to 4 above, searching the key-value database and / or relational database for data corresponding to the second primary key. It should be noted that Figure 3 Although the description of the relevant process of querying the data corresponding to the second primary key in the key-value database and / or the relational database is omitted, it can be understood that the process is the same as the process of querying the first data and the second data based on the first primary key.

[0058] This embodiment provides a specific implementation method for querying the second primary key corresponding to a keyword in an inverted index database, as shown below: according to a preset resource configuration parameter, determine the number of the document in the inverted index database as the return result of the inverted index database. The above resource configuration parameter is such as the "_source" parameter in ES (Elastic Search).

[0059] Since the inverted index stored in the inverted index database is used to record which documents contain a certain term, the inverted index can quickly find all documents containing the term according to the term; therefore, when data is queried in the inverted index database according to the keyword through the inverted index, all documents containing the keyword will be obtained. If all documents are directly packaged as the corresponding result of the data access request, there will be a search delay of seconds and extremely high bandwidth consumption.

[0060] In this case, this embodiment determines that the inverted index database returns the document number as the result according to the resource configuration parameters; wherein the resource configuration parameters are parameters used to reflect the return result of the inverted index database. In the case where the resource configuration parameters are not set, the inverted index database will return all documents by default; in the case where the resource configuration parameters are set, the inverted index database will return the corresponding data according to the specific value of the resource configuration parameters. The resource configuration parameters in this embodiment are configured with specific values ​​to determine that the return result of the inverted index database is the document number. Obviously, the return response speed of the inverted index database can be optimized through the resource configuration parameters.

[0061] According to the pre-configuration of resource configuration parameters, it is determined that the return result of the inverted index database is the document number; based on this, the specific implementation method of querying the second primary key corresponding to the keyword in the inverted index database is: searching for the target document containing the keyword in the documents of the inverted index database, and determining the number of the target document as the second primary key returned to the key-value database.

[0062] Then, the key value corresponding to the second primary key is queried in the key-value database; if all the key values ​​corresponding to the second primary key can be queried in the key-value database, the queried data is used as the response result of the data access request; if all the key values ​​corresponding to the second primary key cannot be queried in the key-value database, for the second primary key whose corresponding key value has not been queried, the data corresponding to the part of the second primary key is queried in the relational database, and the data queried in the key-value database and the data queried in the relational database are packaged, and the packaged result is used as the response result of the data access request.

[0063] When facing ad hoc queries from data access parties, traditional relational databases may cause slow queries that scan the entire table without establishing appropriate indexes, resulting in inefficient ad hoc queries. In contrast, the data access method provided in this embodiment introduces an inverted index database and a key-value database on the basis of a relational database. First, the second primary key is returned through the inverted index database, and then the second primary key is used to query data in the key-value database and / or the relational database. This method fully reduces the search delay caused by the inverted index. The inventors have found through actual operation that the data access method implemented by the inverted index database and the key-value database in this embodiment can reduce the original search delay of seconds to about 200ms, effectively improving the inefficiency of ad hoc queries in relational databases.

[0064] In actual applications, after data changes with business changes, data synchronization between relational databases, key-value databases, and inverted index databases is a critical step. Figure 4 The data processing method provided in this embodiment further includes:

[0065] (1) Receiving a data change request; wherein a data change request is a request to add, delete or modify data. Specifically, the relational database receives a data change request from a data changer to add, delete or modify business data.

[0066] (2) The data in the relational database is changed according to the data change request, and the key-value database is called synchronously to cache the key-value pairs corresponding to the changed data in the relational data into the key-value database.

[0067] Specifically, according to the data change request, the data in the relational database is changed in a transaction mode; wherein, the transaction is an indivisible logical unit composed of a series of data operations or instructions in order to ensure the consistency and integrity of the data; when the transaction is successfully executed, all the changes made to the data in the transaction will become persistent changes in the relational database. This embodiment can make full use of the characteristics of the relational database, and in the process of changing the data, the existence of the key-value database and the inverted index database will not be perceived, so that the user can complete the change through the characteristics of the transaction supported by the relational database itself.

[0068] Based on the changed data in the relational data, the key-value database is synchronously called to change the data. For example, when the changed data in the relational data is the added new business data, the key-value pairs corresponding to the new business data are cached in the key-value database; when the changed data in the relational data is the modified data for the original business data, the key-value pairs corresponding to the original business data in the key-value database are synchronously modified to make the modified key-value pairs consistent with the modified data. After synchronously calling the key-value database to change the data, it continues to provide a basis for subsequent data queries.

[0069] When changing data in a relational database, synchronously calling the key-value database can better solve the problem that the relational database creates too many indexes to support search, which results in excessive storage space occupation and affects data modification performance.

[0070] (3) When the relational database completes the data change, a change log is generated; wherein the change log is used to record the changed data in the relational database.

[0071] (4) By consuming the change log, the inverted index related to the changed data in the inverted index database is changed. After that, when the data change in the inverted index database is completed, the relational database returns a success result to the data change party.

[0072] Specifically, when data changes are completed in a transactional mode, the relational database will generate several change logs, which are Binlogs. Then, the inverted index database is changed by consuming Binlogs to ensure data consistency between the inverted index database and the relational database. For example, the term a of the changed data in the relational data is obtained according to the change log, and the document containing the term a in the inverted index database is document w. Then, the relevant inverted index is changed so that the modified inverted index record document w contains the term a.

[0073] This embodiment can realize the dissociation between database systems by asynchronously refreshing the change data to the inverted index database through Binlog; and can control the delay between the data in the inverted index database and the data in the relational database to be at the millisecond level, which is equal to the master-slave delay level in the relational database.

[0074] In summary, the data processing method provided by the embodiments of the present disclosure fully utilizes the respective storage advantages of the relational database, key-value database and inverted index database in the hybrid storage system, so that ad hoc query operations can achieve low-latency real-time performance and can carry ad hoc query traffic that is significantly higher than that of traditional relational databases.

[0075] Figure 5 This is a schematic diagram of the structure of a data processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and can generally be integrated in an electronic device. It can implement data access and data change by executing a data processing method. Figure 5 As shown, the device may include:

[0076] The request receiving module 502 is used to receive a data access request; wherein the data access request carries an access field of the data to be accessed;

[0077] A first query module 504, configured to query data corresponding to the first primary key in a key-value database and / or a relational database of a hybrid storage system when the access field is the first primary key; wherein the hybrid storage system includes: a relational database, a key-value database, and an inverted index database;

[0078] A second query module 506 is used to query a second primary key corresponding to the keyword in the inverted index database when the access field is a keyword, and query data corresponding to the second primary key in the key-value database and / or the relational database;

[0079] The response module 508 is used to respond to the data access request based on the queried data.

[0080] In one embodiment, the first query module 504 is specifically used to:

[0081] A key value corresponding to a first primary key is queried in a key-value database; if a key value corresponding to the first primary key exists in the key-value database, the key value corresponding to the first primary key is determined as the first data; if a key value corresponding to the first primary key does not exist in the key-value database, second data corresponding to the first primary key is queried in a relational database based on an SQL query method.

[0082] In one embodiment, the first query module 504 is also used to: write the second data into the key-value database, and package the first data and the second data; accordingly, the response module 508 is specifically used to: use the packaged result of the first data and the second data as the response result of the data access request.

[0083] In one embodiment, the first query module 504 is further configured to: use the second data as the key value of the first primary key and cache it in a key value database.

[0084] In one embodiment, the above-mentioned device also includes a configuration module, which is used to: determine the number of the document in the inverted index database as the return result of the inverted index database according to preset resource configuration parameters; accordingly, the second query module 506 is specifically used to: search for target documents containing keywords in the documents of the inverted index database, and determine the number of the target document as the second primary key returned to the key-value database.

[0085] In one embodiment, the above-mentioned device also includes a data change module; the data change module is used to: receive a data change request; wherein the data change request is a request to add, delete or modify data; change the data in the relational database according to the data change request, and synchronously call the key-value database to cache the key-value pairs corresponding to the changed data in the relational data to the key-value database.

[0086] In one embodiment, the above-mentioned data change module is also used to: generate a change log when the relational database completes the data change; wherein the change log is used to record the changed data in the relational database; and change the inverted index related to the changed data in the inverted index database by consuming the change log.

[0087] The data processing device provided in the embodiments of the present disclosure can execute the data processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0088] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the data processing method in the above embodiment.

[0089] Figure 6The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the electronic device 600 includes one or more processors 601 and a memory 602 .

[0090] The processor 601 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 600 to perform desired functions.

[0091] The memory 602 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 601 may run the program instructions to implement the data processing method of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0092] In one example, the electronic device 600 may further include: an input device 603 and an output device 604 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0093] In addition, the input device 603 may also include, for example, a keyboard, a mouse, and the like.

[0094] The output device 604 can output various information to the outside, including the determined distance information, direction information, etc. The output device 604 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0095] Of course, to simplify, Figure 6 Only some of the components related to the present disclosure in the electronic device 600 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 600 may also include any other appropriate components.

[0096] In addition to the above-mentioned method and device, the embodiment of the present disclosure may also be a computer program product, which includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the data processing method described in the embodiment of the present disclosure are implemented.

[0097] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0098] In addition, the embodiments of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the data processing method provided by the embodiments of the present disclosure.

[0099] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0100] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0101] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method, characterized in that: include: Receiving a data access request; wherein the data access request carries an access field of the data to be accessed; When the access field is a first primary key, querying data corresponding to the first primary key in a key-value database and / or a relational database of a hybrid storage system; wherein the hybrid storage system comprises: the relational database, the key-value database and an inverted index database; When the access field is a keyword, a second primary key corresponding to the keyword is queried in the inverted index database, and data corresponding to the second primary key is queried in the key-value database and / or the relational database; wherein the second primary key is the number of the target document containing the keyword; responding to the data access request based on the queried data; The query method of the inverted index database is to determine the serial number of the document in the inverted index database as the return result of the inverted index database according to the preset resource configuration parameters.

2. The method according to claim 1, characterized in that The key-value database and the inverted index database are slave libraries of the relational database; wherein the key-value database is used to store the business data in the relational database as key-value pairs, the primary key in the key-value pair is a field in the business data and is used to identify the business data, and the key value in the key-value pair is the business data identified by the primary key; The inverted index database is used to cache inverted indexes, and the inverted index is used to record entries of business data in the relational database contained in numbered documents.

3. The method according to claim 1 or 2, characterized in that: The querying of the data corresponding to the first primary key in the key-value database and / or the relational database of the hybrid storage system includes: Querying the key value corresponding to the first primary key in the key value database; If a key value corresponding to the first primary key exists in the key-value database, determining the key value corresponding to the first primary key as the first data; If the key value corresponding to the first primary key does not exist in the key-value database, the second data corresponding to the first primary key is queried in the relational database based on an SQL query method.

4. The method according to claim 3, characterized in that After querying the relational database for second data corresponding to the first primary key based on the SQL query method, the method further includes: Writing the second data into the key-value database, and packaging the first data and the second data; The responding to the data access request based on the queried data includes: The packaging result of the first data and the second data is used as a response result of the data access request.

5. The method according to claim 3, characterized in that: After querying the relational database for second data corresponding to the first primary key based on the SQL query method, the method further includes: The second data is used as the key value of the first primary key and cached in the key value database.

6. The method according to claim 1 or 2, characterized in that: The method further comprises: Receiving a data change request; wherein the data change request is a request to add, delete or modify data; The data in the relational database is changed according to the data change request, and the key-value database is synchronously called to cache the key-value pairs corresponding to the changed data in the relational data into the key-value database.

7. The method according to claim 6, characterized in that The method further comprises: When the relational database completes the data change, a change log is generated; wherein the change log is used to record the changed data in the relational database; By consuming the change log, the inverted index related to the changed data in the inverted index database is changed.

8. A data processing device, characterized in that: include: A request receiving module, used to receive a data access request; wherein the data access request carries an access field of the data to be accessed; A first query module, used for querying data corresponding to the first primary key in a key-value database and / or a relational database of a hybrid storage system when the access field is a first primary key; wherein the hybrid storage system includes: the relational database, the key-value database and an inverted index database; A second query module is used for, when the access field is a keyword, querying a second primary key corresponding to the keyword in the inverted index database, and querying data corresponding to the second primary key in the key-value database and / or the relational database; wherein the second primary key is the number of the target document containing the keyword; A response module, used for responding to the data access request based on the queried data; The query method of the inverted index database is to determine the serial number of the document in the inverted index database as the return result of the inverted index database according to the preset resource configuration parameters.

9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the data processing method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the data processing method described in any one of claims 1 to 7.