Index operation method and device, computing equipment cluster and storage medium

By introducing index operation commands in the key-value database, users can specify the target index and operation type, solving the problem of inflexible index operations in the existing technology, improving operation efficiency and user experience, and achieving more efficient data storage and querying .

CN119322866APending Publication Date: 2025-01-17HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311243727.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-07-17
Filing Date
2023-09-25
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

The existing key-value database does not support user-specified indexes, resulting in poor user experience, low operation efficiency, and inability to control the generation and modification of index records. In addition, the index needs to be matched through conditions during query and scanning, which is relatively inefficient.

Method used

Provide an index operation method, allowing users to specify target index and operation type through index operation commands, and supports updating, querying and scanning indexes in key-value databases. Users can directly specify the names and key values ​​of primary key index and secondary indexes, flexible Controls the storage and query path of data.

Benefits of technology

Improve the operation efficiency and user experience of key-value databases. Users can directly specify indexes to operate, simplify the database workflow, improve data access and query efficiency, and enhance the flexibility of data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119322866A_ABST
    Figure CN119322866A_ABST
Patent Text Reader

Abstract

The invention discloses an index operation method and device, a computing device cluster and a storage medium, and the method comprises the following steps: firstly, a key value database receives a first index operation command, the first index operation command comprises an index name of a target index and a first index operation type, and then the index operation type of the target index is determined according to the first index operation command; and executing the operation of the first index operation type on the target index. Wherein the target index comprises a target primary key index and / or a target secondary index, the target primary key index comprises a target primary key and target data corresponding to the target primary key, the target secondary index comprises a target secondary index key and the target primary key, and the target secondary index is used for the key value database to obtain the target primary key; and obtaining target data corresponding to the target primary key based on the target primary key. According to the scheme, the user is supported to specify the index to operate, and the operation efficiency and the user experience of the key value database are improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to the Chinese patent application filed with the Patent Office of the State Intellectual Property Office of China on July 17, 2023, with application number 202310876330.6 and application name "A method, device and other equipment for indexing operations", all of which are incorporated by reference in this application. Technical Field

[0002] The present application relates to the field of cloud computing technology, and in particular to an index operation method, apparatus, computing device cluster and storage medium. Background Art

[0003] A key-value database is a non-relational database that stores data in the form of key-value pairs, where each value is associated with a unique key. The keys and values ​​in a key-value database can be anything from simple objects to complex composite objects, so it is often used to store semi-structured data such as documents, log files, and emails.

[0004] Indexes are an important part of improving the performance and query efficiency of key-value databases, and can be divided into primary key indexes and secondary indexes. When a user creates a table in a key-value database, he can set a primary key index for the table and one or more secondary indexes for it.

[0005] However, the current key-value database does not support user-specified indexes. The key-value database automatically determines which index(es) need to be operated on, resulting in a poor user experience. For example, when a user requests to insert or update a piece of data into a database table, the key-value database will automatically generate a corresponding primary key index record in the primary key index of the database table (including the data and the primary key corresponding to the data), and generate a corresponding secondary index record in each secondary index of the database table (including the above primary key and secondary index key). Users cannot control the generation and modification of index records. For another example, when a user requests to scan the key-value database, the key-value database will automatically match the corresponding index for scanning based on the conditions given by the user, but does not support directly specifying the index in the above conditions, making it difficult for users to set appropriate conditions. Summary of the invention

[0006] The present application provides an index operation method, apparatus, computing device cluster and storage medium, which support users to specify indexes for operation, and help improve the operation efficiency and user experience of key-value databases.

[0007] In the first aspect, the present application provides an index operation method: a key-value database receives a first index operation command, the first index operation command includes the index name of the target index and the first index operation type, and then the key-value database performs the operation of the first index operation type on the target index according to the first index operation command. Among them, the key-value database stores data in the form of key-value pairs, and the key-value database includes at least a primary key index (and may also additionally include a secondary index), and the primary key index includes at least one primary key and at least one data corresponding to the primary key. The above-mentioned target index is an index that needs to be operated, including a target primary key index (including at least one primary key index) and / or a target secondary index (including at least one secondary index), the target primary key index includes a target primary key and target data corresponding to the target primary key, the target secondary index includes a target secondary index key and a target primary key, and the target secondary index is used for the key-value database to obtain the target primary key, and obtain the target data corresponding to the target primary key based on the target primary key.

[0008] Since this solution supports users to specify indexes for operations, that is, users can specify the index name of the index to be operated (i.e., the target index) and the corresponding index operation type to the key-value database according to their own needs, it can improve the operating efficiency and flexibility of the key-value database and improve the user experience.

[0009] Based on the first aspect, in a possible implementation scheme, the user can indicate the index names of the first primary key index (belonging to the target primary key index) and the first secondary index (belonging to the target secondary index) in the first index operation command, and indicate that the first index operation type is an update type, and can also indicate the first primary key (i.e., a certain primary key) in the first index operation command. Then, the key-value database can obtain the first data corresponding to the first primary key in the first primary key index according to the first index operation command, and then move the first data to the first secondary index.

[0010] In other words, this solution supports the update operation of the specified index to move the user-specified data (which can be specified by giving the primary key corresponding to the data) from the user-specified primary key index to the user-specified secondary index, that is, the user can actively control which index the data is stored on, which is highly flexible. After the data is moved to the secondary index, the subsequent key-value database only needs to access the secondary index once to obtain the data, without going through two access processes (first access the secondary index to obtain the primary key, and then access the primary key index based on the primary key to obtain the data corresponding to the primary key), thereby improving data access efficiency.

[0011] Based on the first aspect, in a possible implementation scheme, the user can indicate the index names of the second secondary index and the third secondary index (both belong to the target secondary index) in the first index operation command, and indicate that the first index operation type is an update type, and can also indicate the first secondary index key in the first index operation command. Then, the key-value database can read the second data corresponding to the first secondary index key in the second secondary index according to the first index operation command, and then move the second data to the third secondary index.

[0012] That is to say, this solution supports moving user-specified data (which can be specified by giving the secondary index key corresponding to the data) from one of the secondary indexes specified by the user to another secondary index specified by the user, which is highly flexible. For example, suppose the data corresponding to a primary key in a primary key index is moved to the second secondary index. Later, if the user wants to change the location of the data again, he can instruct the key-value database to move the data from the second secondary index to the third secondary index according to the method of this solution.

[0013] Based on the first aspect, in a possible implementation scheme, the user can indicate the second primary key index (belonging to the target primary key index) and / or the fourth secondary index (belonging to the target secondary index) in the first index operation command, and indicate that the first index operation type is a query type, and can also specify the second primary key in the first index operation command. Then, the key-value database can query the third data corresponding to the second primary key in the second primary key index and / or the fourth secondary index according to the first index operation command. Similarly, a secondary index key and a fourth secondary index can be specified in the first index operation command, and then the key-value database can query the data corresponding to the secondary index key in the fourth secondary index according to the first index operation command.

[0014] Since this solution supports query operations by specifying an index, it is convenient for users to set operation commands that meet query requirements, thereby improving user experience. In addition, the key-value database can directly determine the target index indicated in the first index operation command as the index to be queried, without the need to indirectly determine the index to be queried through condition matching, thereby simplifying the work of the key-value database and improving the data query efficiency of the key-value database.

[0015] Based on the first aspect, in a possible implementation scheme, the user can indicate the third primary key index (belonging to the target primary key index) and / or the fifth secondary index (belonging to the target secondary index) in the first index operation command, and indicate that the first index operation type is a scan type. Then, the key-value database scans the third primary key index and / or the fifth secondary index according to the first index operation command to obtain multiple data corresponding to multiple primary keys and / or multiple secondary index keys in the third primary key index and / or the fifth secondary index.

[0016] Since this solution supports scanning operations by specifying an index, it is convenient for users to set operation commands that meet scanning requirements, thereby improving user experience. In addition, the key-value database can directly determine the target index indicated in the first index operation command as the index to be scanned, without the need to indirectly determine the index to be scanned through condition matching, thereby simplifying the work of the key-value database and improving the data scanning efficiency of the key-value database.

[0017] In a second aspect, the present application provides an index operation device, which is applied to a key-value database (refer to the introduction of the first aspect), and the index operation device includes a receiving module and a processing module. The receiving module is used to receive a first index operation command, and the first index operation command includes the index name of the target index and the first index operation type, wherein the target index includes a target primary key index and / or a target secondary index, the target primary key index includes a target primary key and target data corresponding to the target primary key, the target secondary index includes a target secondary index key and a target primary key, and the target secondary index is used to obtain the target primary key in the key-value database, and obtain the target data corresponding to the target primary key based on the target primary key. The processing module is used to perform an operation of the first index operation type on the target index according to the first index operation command.

[0018] The index operation device of the second aspect may also include more or fewer functional modules, and may also have other functional module division methods, which are not specifically limited here. The index operation device of the second aspect is specifically used to execute the method of any implementation scheme in the first aspect, please refer to the above introduction for details, which will not be repeated here.

[0019] In a third aspect, the present application further provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory. The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method of any implementation scheme in the first aspect.

[0020] In a fourth aspect, the present application further provides a computer-readable storage medium comprising computer program instructions. When the above-mentioned computer program instructions are executed by a computing device cluster (including at least one computing device), the computing device cluster executes a method as in any implementation scheme in the first aspect.

[0021] In a fifth aspect, the present application further provides a computer program product comprising instructions. When the instructions are executed by a computing device cluster (including at least one computing device), the computing device cluster executes the method of any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for describing the embodiments are briefly introduced below.

[0023] Figure 1 This is a schematic diagram of a two-index search process provided in an embodiment of the present application;

[0024] Figure 2 It is a schematic diagram of the architecture of a business system based on a key-value database provided in an embodiment of the present application;

[0025] Figure 3 It is a flowchart of an index operation method provided in an embodiment of the present application;

[0026] Figure 4 is a schematic diagram of updating an index provided in an embodiment of the present application;

[0027] Figure 5 It is a schematic diagram of a process of executing data marking and deletion provided in an embodiment of the present application;

[0028] Figure 6 This is a schematic diagram of an index state after data is marked and deleted provided in an embodiment of the present application;

[0029] Figure 7 is a structural schematic diagram of an index operation device provided in an embodiment of the present application;

[0030] Figure 8 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0031] Fig. 9 is a schematic diagram of a computing device cluster provided in an embodiment of the present application;

[0032] Fig.10 It is a schematic diagram of interaction between computing devices through a network provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] A key-value database is a non-relational database that stores data in the form of key-value pairs, where each value is associated with a unique key. The keys and values ​​in a key-value database can be anything from simple objects to complex composite objects, so it is often used to store semi-structured data such as documents, log files, and emails.

[0034] Indexes are an important component used to improve the performance and query efficiency of key-value databases, and can be divided into primary key indexes and secondary indexes (also called auxiliary indexes). A key-value database includes at least a primary key index, which includes at least one primary key and the data corresponding to the at least one primary key. In addition to the primary key index, a key-value database can also include secondary indexes. For example, when a user creates a database table in a key-value database, he can set a primary key index for the database table, and can also choose to set 0 to N (positive integer) secondary indexes for the database table.

[0035] In one solution, the key-value database automatically matches the index according to the conditions set by the user (without directly specifying the index), and then performs corresponding operations on the matched index. This solution has low operational efficiency.

[0036] For example, Figure 1 As shown in the figure, a database table in the key-value database has a primary key index and two secondary indexes (respectively denoted as 1# secondary index and 2# secondary index). Each row of the primary key index represents a primary key index record, and a primary key index record includes a primary key and a piece of data corresponding to the primary key ( Figure 1 Take the data type as an example). Each row in the secondary index represents a secondary index record, and a secondary index record may include a secondary index key and a primary key. Assuming that the user requests to query the data under the condition of "age=20", the key-value database will first perform index matching according to the query condition, and here it matches the 1# secondary index (i.e. step ①), and then obtain the primary key {name: "Rose"} corresponding to the secondary index key "age=20" from the 1# secondary index, and then the key-value database continues to access the primary key index according to the above primary key (i.e. step ②), thereby obtaining a piece of data corresponding to the primary key, that is, the complete document content {name: "Rose", age: 20, score: 89, sex: f}.

[0037] In order to improve the operating efficiency of the key-value database, an embodiment of the present application provides an index operation method, which supports users to specify indexes for operation. The key-value database does not need to determine the index to be operated through condition matching, thereby simplifying the operation process of the key-value database and improving the operating efficiency, flexibility and user experience of the key-value database.

[0038] The following is a detailed introduction to the index operation method provided in the embodiment of the present application.

[0039] See also Figure 2 , Figure 21 is a schematic diagram of the architecture of a business system provided in an embodiment of the present application, including a business access layer 100 and a key-value database 200. The present embodiment of the present application does not specifically limit the specific type of the business system, for example, the business system may be an e-commerce shopping system, a file system, etc.

[0040] The business access layer 100 provides some functional interfaces to the clients of the business system for parsing and processing the business requests issued by the clients. For example, assuming that the business system is a file system, the business access layer 100 can provide some simple functional interfaces to the clients, such as read(), write(), delete unlink(), read directory readdir() and other interfaces. The clients can send business requests to the business access layer 100 by calling the above functional interfaces, thereby realizing their own business needs. The functions of the business access layer 100 can be implemented by one or more computing devices (such as desktop computers, servers, etc.), and the embodiments of the present application do not make specific limitations.

[0041] The key-value database 200 is used to provide data storage capabilities. The key-value database 200 can provide some index operation interfaces to the business access layer 100 (the business access layer 100 is equivalent to the user of the key-value database 200). The business access layer 100 generates a first index operation command by calling the above index operation interface to instruct the key-value database 200 to operate the target index (such as update, query, scan, etc.), thereby realizing data management. Among them, the first index operation command includes the index name of the target index and the first index operation type, and the target index is the specified index to be operated.

[0042] Optionally, the target index includes a target primary key index and / or a target secondary index, the target primary key index includes at least one primary key index, and the target secondary index includes at least one secondary index. The target primary key index includes a target primary key and target data corresponding to the target primary key. The target primary key can be one or any primary key in the target primary key index, which is not specifically limited in the embodiments of the present application. The target secondary index includes a target secondary index key and the above-mentioned target primary key. The target secondary index is used by the key-value database 200 to obtain the target primary key, and obtain the target data corresponding to the target primary key based on the target primary key.

[0043] For example, Figure 1 As shown, assuming Figure 1The primary key index in is the target primary key index, and the primary key {name: "Rose"} in the target primary key index is the target primary key. Then the target data corresponding to the target primary key is {name: "Rose", age: 20, score: 89, sex: f}. Assume that 1# secondary index is the target secondary index, and the target secondary index contains the above target primary key {name: "Rose"}, and the target primary key in the target secondary index corresponds to the secondary index key "age = 20". Therefore, the key-value database can obtain the target primary key {name: "Rose"} based on the target secondary index key "age = 20" in 1# secondary index, and then continue to access the primary key index according to the target primary key {name: "Rose"} (step ②), so as to obtain the target data corresponding to the target primary key, that is, the complete document content {name: "Rose", age: 20, score: 89, sex: f}.

[0044] Optionally, the operation type of the first index operation may be an update type, a query type, or a scan type, which are respectively introduced below.

[0045] 1. Update type: used to instruct the key-value database 200 to move data from one index to another index.

[0046] Specifically, the key-value database 200 can provide the business access layer 100 with an index operation interface (hereinafter referred to as an update operation application programming interface (API)) that can specify an index for update operation. The business access layer 100 can generate a first index operation command by calling the update operation API and specifying the index names of multiple different indexes and a primary key in the update operation API, and then instruct the key-value database 200 to move the data corresponding to the primary key between the above-mentioned multiple indexes according to the first index operation command.

[0047] For example, the key-value database 200 can provide the following update operation API: update([primary key], RemoveIndex([index name] list or keyword "all"), DocAttachIndex([index name])). Among them, the first parameter [primary key] is used to specify a certain data to be operated (multiple data can also be specified), and can be set to the primary key corresponding to the data in the key-value database 200. RemoveIndex([index name] list or keyword "all") is used to specify which index / indexes in which the index records related to the data need to be deleted: the parameters in the parentheses can be set to the [index name] list, including the index name of a primary key index and / or the index names of one or more secondary indexes; the parameters in the parentheses can also be set to the keyword "all", which means specifying all indexes associated with the data (including the primary key index and all secondary indexes). DocAttachIndex([index name]) is used to specify the index to which the data (that is, the data corresponding to the primary key specified in the first parameter) needs to be moved, which can be a primary key index or a secondary index.

[0048] It should be understood that if the first index operation command is implemented by calling the above-mentioned update operation API, it means that the first operation type of the first index operation command is an update type, and the various indexes specified in the update operation API (which may include a primary key index and / or at least one secondary index) are the target indexes.

[0049] In a first possible implementation, the first index operation type is an update type, the target index includes a first primary key index (belonging to the target primary key index) and a first secondary index (belonging to the target secondary index), and the first index operation command also includes the first primary key. At this time, the first index operation command can enable the key-value database 200 to perform the following operations: obtain the first data corresponding to the first primary key in the first primary key index, and then move the first data to the first secondary index. Among them, the first primary key can be one or more primary keys in the first primary key index, and the first data is one or more data corresponding to the first primary key. In other words, this solution supports moving user-specified data (which can be specified by giving the primary key corresponding to the data) from the user-specified primary key index to the user-specified secondary index, that is, the index on which the data is stored can be actively controlled by the user, and it is highly flexible.

[0050] In a second possible implementation, the first index operation type is an update type, the target index includes a second secondary index and a third secondary index (both belong to the target secondary index), and the first index operation command also includes a first secondary index. At this time, the first index operation command can enable the key-value database 200 to perform the following operations: read the second data corresponding to the first secondary index key in the second secondary index, and then move the second data to the third secondary index. Among them, the first secondary index key can be one or more secondary index keys in the second secondary index, and the second data is one or more data corresponding to the first secondary index key. In other words, in addition to supporting the movement of data from a user-specified primary key index to a user-specified secondary index, the key-value database 200 can also support the movement of data (which can be specified by giving the secondary index key corresponding to the data) from one of the user-specified secondary indexes to another secondary index, that is, which index the data is stored on can be actively controlled by the user, which is more flexible.

[0051] For example, assuming that according to the first implementation scheme mentioned above, the data corresponding to a primary key in a primary key index is moved to a secondary index, the business access layer 100 can then instruct the key-value database 200 to move the data from the above secondary index to another secondary index according to the second implementation scheme based on actual application requirements.

[0052] 2. Query type: used to instruct the key-value database 200 to query specific data from the target index.

[0053] Specifically, the key-value database 200 can provide the business access layer 100 with an index operation interface (hereinafter referred to as a query operation API) that can specify an index for query operations. The business access layer 100 can generate a first index operation command by calling the query operation API and specifying an index name and an index key (which can be a primary key index or a secondary index) of a certain index (which can be a primary key index or a secondary index) in the query operation API, and then instruct the key-value database 200 to query the data corresponding to the specified index key from the target index according to the first index operation command.

[0054] For example, the key-value database 200 provides the user with the following query operation API: get([key], HintIndex([index name])). The first parameter [key] is used to specify an index key, which can be a primary key or a secondary index key, indicating that the data corresponding to the index key is to be obtained, and the second parameter [index name] is used to specify the index name of the index to be queried, which can specify the index name of a primary key index or the index name of a secondary index.

[0055] It should be understood that if the first index operation command is implemented by calling the above query operation API, it means that the first index operation type of the first index operation command is a query type, and the index to be queried specified in the query operation API is the target index.

[0056] 3. Scan type: used to instruct the key-value database 200 to scan the data in the target index.

[0057] Specifically, the key-value database 200 can provide the business access layer 100 with an index operation interface (hereinafter referred to as a scan operation API) that can specify an index for a scan operation. The business access layer 100 can generate a first index operation command by calling the scan operation API and specifying the index name of one or more indexes (i.e., target indexes) in the scan operation API, and then instruct the key-value database 200 to scan the data in the target index according to the first index operation command.

[0058] For example, the key-value database 200 can provide the user with the following scanning operation API: scan(filter, JoinIndex([index name] list)). Among them, the first parameter filter is an optional parameter, which indicates the filtering condition. When calling the scanning operation API, you can choose whether to set the filtering condition as needed. If the filtering condition is not set, it means that the scanning result is not filtered. If the filtering condition is set, the scanning result is filtered according to the filtering adjustment to obtain the filtered data. The second parameter [index name] list is used to specify which index / indexes need to be scanned. The index name of the primary key index and / or the index name of at least one secondary index can be specified here. For example, if only the index name of a primary key index is specified in the second parameter, it means that only the primary key index is scanned; if only the index name of a secondary index is specified in the second parameter, it means that only the secondary index is scanned; if the index name of a primary key index and the index name of a secondary index are specified in the second parameter, it means that both the primary key index and the secondary index need to be scanned.

[0059] It should be understood that if the first index operation command is implemented by calling the above-mentioned scan operation API, it means that the first operation type is a scan type, and the index to be scanned specified in the scan operation API is the target index. It should also be noted that the above-mentioned update operation API, query operation API and scan operation API are only examples and do not constitute specific limitations. For example, the order of the three parameters in the update operation API can be adjusted, and more parameters can be included.

[0060] Based on the above content, the application of the index operation method provided in the embodiment of the present application in the data marking and deletion scenario is introduced below.

[0061] See also Figure 3 , Figure 3 It is a flowchart of an index operation method provided in an embodiment of the present application, including steps S301 to S302.

[0062] S301: The computing device 300 sends a second index operation command to the key-value database 200. Accordingly, the key-value database 200 receives the second index operation command sent by the computing device 300.

[0063] The computing device 300 as a user device of the key-value database 200 may be Figure 1 The computing device in the service access layer 100 is used to implement the functions of the service access layer 100, and can also be other computing devices, which is not specifically limited in the embodiments of the present application.

[0064] The second index operation command is used to instruct the key-value database 200 to mark the first data for deletion. It should be understood that data deletion is achieved by adding a deletion mark to the data to achieve the effect that the data has been deleted. In fact, the data still exists in the key-value database (i.e., logical deletion rather than physical deletion), but this part of the data is hidden from the customer. Based on data deletion, functions such as viewing historical versions and deletion recovery can be realized.

[0065] The first data may be one or more pieces of data in the key-value database 200. The first data may be semi-structured data, which includes documents (such as XML documents, JSON documents, HTML documents, etc.), log files, emails, etc., which are not specifically limited in the embodiments of the present application.

[0066] The first data may belong to a database table in the key-value database 200, and the database table has at least one primary key index, and the database table may also have one or more secondary indexes. The first data may be located in the primary key index of the database table. Among them, the primary key index can be used to uniquely identify each (row) of data in a database table, and each data has a different primary key. The primary key index can be created on any column or multiple columns (one or more fields) in the database table, which can help the key-value database 200 quickly find data in a specific row. Unlike the primary key index, the secondary index is a non-unique index (multiple data may have the same secondary index key), which can be created on one or more non-primary key columns and can be used to speed up query operations.

[0067] For example, Figure 4As shown, suppose a user creates a database table in the key-value database 200, sets a primary key index on the "name" field of the table (the index name is set to layoutIndex), sets a secondary index on the "age" field of the table (represented as 1# secondary index, the index name is set to gcIndex), and sets another secondary index on the "score" field of the table (represented as 2# secondary index, the index name is set to sIndex). Each row of the primary key index represents a primary key index record, and a primary key index record may include a primary key and a piece of data corresponding to the primary key ( Figure 4 Take the data type as an example). Each row in the secondary index represents a secondary index record, and a secondary index record may include a secondary index key and a primary key.

[0068] Assumptions Figure 2 The business access layer 100 and the key-value database 200 are used to implement the file system. A client of the file system sends a business request to the business access layer 100, indicating that it wants to add the document content {name: "Tom", age: 18, score: 100, sex: m} to the file system. After the computing device 300 in the business access layer 100 parses the business request, it chooses to call the insert operation interface provided by the key-value database 200 to instruct the key-value database 200 to insert the above document content into the database table. Then, according to the instructions of the business access layer 100, the key-value database 200 can automatically update the primary key index and all secondary indexes of the data table, that is, Figure 4 A primary key index record is added to the primary key index, and the primary key index record includes the primary key {name: "Tom"} and the document content {name: "Tom", age: 18, score: 100, sex: m}. The key-value database 200 also adds a secondary index record to the 1# secondary index, and the secondary index record includes the secondary index key {age: 18} and the primary key {name: "Tom"}. The key-value database 200 also adds a secondary index record to the 2# secondary index, including the secondary index key {score: 100} and the primary key {name: "Tom"}.

[0069] S302. The key-value database 200 deletes the mapping relationship between the first primary key and the first data in the first primary key index according to the second index operation command, changes the mapping relationship between the first secondary index key and the first primary key in the first secondary index to the mapping relationship between the first secondary index key and the first data, and adds a deletion mark to the first data in the first secondary index.

[0070] The second index operation command may be implemented based on the update operation API described above (ie, one of the index operation interfaces provided by the key-value database 200 ).

[0071] For example, Figure 4 The current status of the primary key index (index name is layoutIndex) and two secondary indexes (index names are gcIndex and sIndex) of a database table in the key-value database 200 is shown. The primary key index contains 4 primary key index records (each row represents a primary key index record), and each primary key index record includes a mapping relationship between a primary key and a complete document content (that is, the data type is document). 1# Secondary index contains 4 secondary index records (each row represents a secondary index record), and each secondary index record includes a mapping relationship between a secondary index key and a primary key. 2# Secondary index contains 4 secondary index records (each row represents a secondary index record), and each secondary index record includes a mapping relationship between a secondary index key and a primary key.

[0072] Assumptions Figure 2 The business access layer 100 and the key-value database 200 are used to implement a file system. A client of the file system sends a business request to the business access layer 100, indicating that it wants to delete the document content {name: "Tom", age: 18, score: 100, sex: m} in the file system. After parsing the business request, the computing device 300 in the business access layer 100 chooses to call the update operation API provided by the key-value database 200 to generate the following second index operation command update(name: "Rose", RemoveIndex(layoutIndex), DocAttachIndex(gcndex)) to instruct the key-value database 200 to mark and delete the document content (corresponding to the first data).

[0073] It should be understood that since the above-mentioned second index operation command is implemented based on the update operation API, the index operation type of the second index operation command is an update type. The first parameter name: "Rose" in the second index operation command is the primary key corresponding to the document content {name: "Rose", age: 20, score: 89, sex: f} (corresponding to the first primary key), which is used to uniquely identify the document content, indicating that an operation is to be performed on the document content (that is, an operation corresponding to the update type). The second parameter layoutIndex is the index name of the primary key index (corresponding to the first primary key index) where the document content is currently located. The third parameter gcndex is the index name of a secondary index (corresponding to the first and second secondary indexes) to which the document content needs to be moved.

[0074] like Figure 5As shown, when the key-value database 200 receives the above-mentioned second index operation command sent by the business access layer 100, the key-value database 200 can obtain the document content from the primary key index layoutIndex, and delete the mapping relationship between the primary key {name: "Rose"} and the document content {name: "Rose", age: 20, score: 89, sex: f}, that is, delete a primary key index record corresponding to the document content in the primary key index (i.e. step ①), and the primary key index no longer saves the document content. The key-value database 200 will also move the document content obtained from the primary key index to the 1# secondary index, specifically, change the mapping relationship between the secondary index key {age = 20} and the primary key {name: "Rose"} recorded in the 1# secondary index to the mapping relationship between the secondary index key {age = 20} and the document content {name: "Rose", age: 20, score: 89, sex: f} (i.e. step ②). The key-value database 200 also adds a deletion mark to the document content in the 1# secondary index ( Figure 5 Taking * as an example), it means that the content of this document is in the state of logical deletion (i.e. marked for deletion).

[0075] Similarly, when the service access layer 100 needs to Figure 5 When marking and deleting the document content {name: "Jack", age: 19, score: 95, sex: m} in the primary key index, the computing device 300 in the service access layer 100 can also send the following index operation command update (name: "Jack", RemoveIndex (layoutIndex), DocAttachIndex (gcndex)) to the key-value database 200 by calling the update operation API to instruct the key-value database 200 to perform marking and deleting related processing on the document content (corresponding to the first data). Then, as Figure 6 As shown, the key-value database 200 deletes the mapping relationship between the primary key {name: "Jack"} and the document content {name: "Jack", age: 19, score: 95, sex: m} in the primary key index according to the index operation command, and changes the mapping relationship between the secondary index key {age: 19} and the primary key {name: "Jack"} in the 1# secondary index to the mapping relationship between the secondary index key {age: 19} and the document content {name: "Jack", age: 19, score: 95, sex: m}, and also adds a deletion mark (here * is used as an example) to the document content in the 1# secondary index. The process of marking and deleting other document contents is similar and will not be repeated here.

[0076] The embodiment of the present application does not specifically limit the method of adding a deletion mark. For example, a mark field can be set for each piece of data in the index. If the value of the data mark field is 0, it means that the data is valid (i.e., non-deleted data), and if the value of the data mark field is 1, it means that the data is deleted data.

[0077] Optional, Figure 3 The following steps S303 and S304 may also be included.

[0078] S303 : The computing device 300 sends a third index operation command to the key-value database 200 . Accordingly, the key-value database 200 receives the third index operation command sent by the computing device 300 .

[0079] S304: The key-value database 200 accesses the target index according to the third index operation command to obtain the target data.

[0080] Optionally, the target index includes a target primary key index and / or a target secondary index, the target primary key index includes at least one primary key index, and the target secondary index includes at least one secondary index.

[0081] In a first possible solution, the third index operation command is used to instruct the key-value database 200 to query the target data in the target index. The index operation type of the third index operation command is a query type, and the third index operation command includes the index name of the target index and an index key (which may be a primary key or a secondary index key, corresponding to the target data). The third index operation command can be implemented based on the query operation API mentioned above (i.e., one of the index operation interfaces provided by the key-value database 200).

[0082] For example, Figure 6 As shown, the document content {name: "Rose", age: 20, score: 89, sex: f} has been moved from the primary key index to the 1# secondary index after processing in step S302. The secondary index key {age: 19} in the 1# secondary index has a corresponding relationship with the document content (belonging to the same secondary index), and the document content is marked for deletion*. Subsequently, when the business access layer 100 needs to query the document content (corresponding to the target data), the query operation API can be called to generate the following third index operation command: get(age: 19, HintIndex(gcIndex)). Among them, the first parameter {age: 19} is a secondary index key in the 1# secondary index corresponding to the document content, and the second parameter gcIndex is the index name of the 1# secondary index (i.e., the target secondary index).

[0083] When the key-value database 200 receives the third index operation command, the key-value database 200 will query the document content {name: "Jack", age: 19, score: 95, sex: m} corresponding to the secondary index key {age: 19} in the 1# secondary index, and then send the document content to the business access layer 100. It should be understood that since the 1# secondary index in the embodiment of the present application can store the marked deleted data, the key-value database 200 can obtain the marked deleted data (i.e. the above document content) required by the user by querying the 1# secondary index. There is only one index access process here (only one secondary index is accessed, and the primary key index does not need to be accessed), thereby improving the query efficiency.

[0084] In a second possible solution, the third index operation command is used to instruct the key-value database 200 to scan the target data in the target index. The index operation type of the third index operation command is a scan type, and the third index operation command includes the index name of the target index, and the target index may include at least one primary key index and / or at least one secondary index. The third index operation command may be implemented based on the scan operation API mentioned above (i.e., one of the index operation interfaces provided by the key-value database 200).

[0085] For example, Figure 6 As shown in the figure, the secondary index key {age: 19} in the 1# secondary index maps a document content {name: "Jack", age: 19, score: 95, sex: m} with a deletion mark *, indicating that the document content is in a logical deletion state and waiting for background recycling. Similarly, the secondary index key {age: 20} in the 1# secondary index maps a document content {name: "Rose", age: 20, score: 89, sex: f} with a deletion mark *, indicating that the document content is also in a logical deletion state and waiting for background recycling.

[0086] Assuming that the business access layer 100 needs to instruct the key-value database 200 to perform garbage collection (GC), the computing device 300 in the business access layer can call the scan operation API to send the following third index operation command to the key-value database 200: scan(JoinIndex("gcIndex")). Among them, the parameter gcIndex is the index name of the 1# secondary index (corresponding to the target secondary index). Then, the key-value database 200 scans the 1# secondary index according to the third index operation command, thereby obtaining the marked and deleted data mapped by all secondary index keys in the 1# secondary index, including the following two document contents {name: "Jack", age: 19, score: 95, sex: m} and {name: "Rose", age: 20, score: 89, sex: f}, which are the target data.

[0087] It should be understood that if all data that need to be marked for deletion are moved to the 1# secondary index in a similar manner to step S302, the 1# secondary index stores all the marked for deletion data (but does not store non-marked for deletion data, which is only stored in the primary key index), so the key-value database 200 can obtain all the marked for deletion data by scanning the 1# secondary index, without accessing the primary key index, with only one index access process, and without filtering the non-marked for deletion data, thereby improving the scanning efficiency of the key-value database 200. After scanning all the marked for deletion data, the key-value database 200 can further remove the marked for deletion data, thereby achieving complete deletion of the marked for deletion data (i.e., physical deletion), and releasing the storage space of the key-value database 200.

[0088] For another example, suppose the service access layer 100 needs to scan Figure 6 The primary key index in the primary key index, that is, scanning all the primary key mapping data in the primary key index (all non-standard deleted data / valid data), at this time, the computing device 300 of the service access layer 100 can call the scan operation API to send the following third index operation command to the key value database 200: scan(JoinIndex("layoutIndex")). Among them, the parameter layoutIndex is the index name of the primary key index (corresponding to the target primary key index). Then, the key value database 200 scans according to the third index operation command Figure 6The primary key index in the primary key index is obtained, thereby obtaining all the primary key mapping data in the primary key index, including the two document contents {name: "Mick", age: 18, score: 65, sex: m} and {name: "Tom", age: 18, score: 100, sex: m}, which are the target data. Subsequently, the key-value database 200 can also send the target data to the computing device 300 of the service access layer 100, thereby realizing the function of traversing all the non-standard deleted data (i.e., valid data) in the database table.

[0089] It should be understood that if all data that need to be marked and deleted are moved to the 1# secondary index in a similar manner to step S302, the 1# secondary index stores all marked and deleted data, and the primary key index only contains non-marked and deleted data, and does not contain non-marked and deleted data, then the key-value database 200. Therefore, the key-value database 200 can obtain all non-marked and deleted data directly by scanning the primary key index, and does not need to perform the operation of filtering the marked and deleted data, thereby improving the operating efficiency of the key-value database 200.

[0090] For another example, suppose the service access layer 100 needs to scan Figure 6 If the primary key index and 1# secondary index are in the key-value database, the service access layer 100 can call the scan operation API to send the following third index operation command to the key-value database 200: scan(JoinIndex("layoutIndex", "gcIndex")). The parameter layoutIndex is the index name of the primary key index (corresponding to the target primary key index), and the parameter gcIndex is the index name of the 1# secondary index (corresponding to the target secondary index). Then, the key-value database 200 scans according to the third index operation command. Figure 6 , thereby obtaining all the data mapped by the primary key in the primary key index, including the two document contents {name: "Mick", age: 18, score: 65, sex: m} and {name: "Tom", age: 18, score: 100, sex: m}, both of which are valid data. In addition, the key-value database 200 will also scan the 1# secondary index according to the third index operation command, thereby obtaining the marked-deleted data mapped by all the secondary index keys in the 1# secondary index, including the following two document contents {name: "Jack", age: 19, score: 95, sex: m} and {name: "Rose", age: 20, score: 89, sex: f}, which have deletion marks in the 1# secondary index and are therefore marked-deleted data. At this point, the key-value database 200 obtains all the data in the database table (including all non-marked-deleted data and all marked-deleted data, i.e., target data), thereby realizing the function of traversing all the data in the database table.

[0091] It should be noted that the index is a data structure designed to improve data query efficiency. Figure 1 , Figure 4 , Figure 5 and Figure 6 The structures and index names of various indexes (including primary key indexes and secondary indexes) are only examples and do not constitute specific limitations. Indexes can also be implemented in the key-value database 200 using B+ trees, arrays, etc., which are not specifically limited in the embodiments of the present application.

[0092] In summary, the index operation method provided in the embodiment of the present application supports the operation of a specified index, and can be used in data marking and deletion or other scenarios where a specified index is required for operation. In the data marking and deletion scenario, the computing device 300 calls the update operation API provided by the key-value database 200, and specifies the target primary key index and the target secondary index in the update operation API, thereby instructing the key-value database 200 to move the data from the target primary key index to the target secondary index, and adds a deletion mark to the data moved to the target secondary index, indicating that the data is in a logical deletion state.

[0093] It should be understood that by performing data marking and deletion in the above manner, only non-standard deleted data (i.e., valid data) can be present in the primary key index, but no non-standard deleted data exists. Therefore, the key-value database 200 can obtain all non-standard deleted data by scanning the primary key index, and there is no need to perform filtering operations after the scanning is completed, thereby simplifying the work of the key-value database 200, improving the scanning efficiency of the key-value database 200, and feeding back the scanning results to the user as soon as possible, thereby improving the user experience. Performing data marking and deletion in the above manner can also make the secondary index store marked deleted data, but not non-standard deleted data. Therefore, the key-value database 200 can obtain all marked deleted data by scanning the secondary index, without scanning the primary key index, and without performing filtering operations, thereby simplifying the work of the key-value database 200, and improving the scanning efficiency of the key-value database 200.

[0094] See also Figure 7 , Figure 7 7 is a schematic diagram of the structure of an index operation device 700 provided in an embodiment of the present application, including a receiving module 701 and a processing module 702. The index operation device 700 is applied to the key-value database 200. For the key-value database 200, please refer to the full text introduction, which will not be repeated here.

[0095] The receiving module 701 is used to receive a first index operation command, which includes the index name of the target index and the first index operation type, wherein the target index includes a target primary key index and / or a target secondary index, the target primary key index includes a target primary key and target data corresponding to the target primary key, the target secondary index includes a target secondary index key and a target primary key, and the target secondary index is used to obtain the target primary key in a key-value database, and obtain the target data corresponding to the target primary key based on the target primary key.

[0096] The processing module 702 is used to perform an operation of a first index operation type on a target index according to a first index operation command.

[0097] Optionally, the first index operation type is an update type, the target index includes a first primary key index and a first secondary index, and the processing module 702 is specifically used to: obtain the first data corresponding to the first primary key in the first primary key index according to the first index operation command; and move the first data to the first secondary index.

[0098] Optionally, the first index operation type is an update type, the target index includes a second secondary index and a third secondary index, and the processing module 702 is specifically used to: read the second data corresponding to the first secondary index key in the second secondary index according to the first index operation command; and move the second data to the third secondary index.

[0099] Optionally, the first index operation type is a query type, the target index includes a second primary key index and / or a fourth secondary index, and the processing module 702 is specifically used to: query the third data corresponding to the second primary key in the second primary key index and / or the fourth secondary index according to the first index operation command.

[0100] Optionally, the first index operation type is a scan type, and the target index includes a third primary key index and / or a fifth secondary index. The processing module 702 is specifically used to: scan the third primary key index and / or the fifth secondary index according to the first index operation command, and obtain multiple data corresponding to multiple primary keys and / or multiple secondary index keys in the third primary key index and / or the fifth secondary index.

[0101] It should be noted that the above-mentioned receiving module 701 and processing module 702 can be implemented by software, or can be implemented by hardware, or can be implemented by both software and hardware. Exemplarily, the implementation of the processing module 702 is described below by taking the processing module 702 as an example. Similarly, the implementation of the above-mentioned other modules can refer to the implementation of the processing module 702.

[0102] As an example of a software functional unit, the processing module 702 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the processing module 702 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.

[0103] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0104] As an example of a hardware functional unit, the processing module 702 may include at least one computing device, such as a server, etc. Alternatively, the processing module 702 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0105] The multiple computing devices included in the processing module 702 can be distributed in the same region or in different regions. The multiple computing devices included in the processing module 702 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the processing module 702 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0106] It should be noted that, in other embodiments, the above-mentioned processing module 702 and receiving module 701 can be used to execute any steps of the index operation method provided in the embodiments of the present application, and the steps that these modules are responsible for implementing can be specified as needed. By respectively implementing different steps in the index operation method, all functions of the index operation device 700 can be realized.

[0107] It should also be noted that the above-mentioned index operation device 700 is used to execute any embodiment of the index operation method provided in the present application. Please refer to the above description for details, which will not be repeated here. Figure 7 The index operation device 700 is only used as an example to illustrate the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the index operation device 700 can be divided into other different functional modules to complete all or part of the functions described above.

[0108] See also Figure 8 The present application also provides a computing device 800, including a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate with each other through the bus 802. The computing device 800 may be a server, a terminal device, etc., and the present application embodiment does not make a specific limitation, and the present application embodiment does not limit the number of processors and memories in the computing device 800.

[0109] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 802 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 802 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).

[0110] The processor 804 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0111] The memory 806 may include a volatile memory, such as a random access memory (RAM). The processor 804 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0112] The memory 806 stores executable program codes. The processor 804 executes the executable program codes to respectively implement Figure 7 The functions of the receiving module 701 and the processing module 702 are implemented to realize any embodiment of the index operation method provided in the present application.

[0113] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or communication networks.

[0114] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0115] like Fig. 9 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the index operation method of the previous embodiment.

[0116] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the index operation method of the previous embodiment. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for the index operation method of the previous embodiment.

[0117] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the index operation device 700 of 7. That is, the instructions stored in the memory 806 in different computing devices 800 can be implemented. Figure 7 The functions of one or more modules in the receiving module 701 and the processing module 702.

[0118] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.10 A possible implementation is shown. Fig.10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the receiving module 701. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the processing module 702.

[0119] It should be understood that Fig.10 The functions of the computing device 800A shown in FIG. 8 may also be jointly completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be jointly completed by multiple computing devices 800.

[0120] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig.10 The connection mode of the computing device cluster is different in that the memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the index operation method of the previous embodiment.

[0121] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the index operation method that can implement the previous embodiment. In other words, the combination of one or more computing devices 800 can jointly execute instructions for executing the index operation method that can implement the previous embodiment.

[0122] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct a computing device cluster (including at least one computing device) to execute any embodiment of the index operation method provided in the present application.

[0123] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes any embodiment of the index operation method provided in the present application.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. An index operation method, characterized in that: The method is applied to a key-value database, the key-value database stores data in the form of key-value pairs, the key-value database at least includes a primary key index, the primary key index includes at least one primary key and data corresponding to the at least one primary key, and the method includes: Receive a first index operation command, the first index operation command including an index name of a target index and a first index operation type, wherein the target index includes a target primary key index and / or a target secondary index, the target primary key index includes a target primary key and target data corresponding to the target primary key, the target secondary index includes a target secondary index key and the target primary key, the target secondary index is used by the key-value database to obtain the target primary key, and based on the target primary key, obtain the target data corresponding to the target primary key; According to the first index operation command, an operation of the first index operation type is performed on the target index.

2. The method according to claim 1, characterized in that: The first index operation type is an update type, the target index includes a first primary key index and a first secondary index, the first index operation command also includes a first primary key, and performing an operation of the first index operation type on the target index according to the first index operation command includes: According to the first index operation command, obtain first data corresponding to the first primary key in the first primary key index; The first data is moved to the first secondary index.

3. The method according to claim 1, characterized in that The first index operation type is an update type, the target index includes a second secondary index and a third secondary index, the first index operation command also includes a first secondary index key, and performing the operation of the first index operation type on the target index according to the first index operation command includes: Reading, according to the first index operation command, second data corresponding to the first secondary index key in the second secondary index; The second data is moved to the third secondary index.

4. The method according to claim 1, characterized in that The first index operation type is a query type, the target index includes a second primary key index and / or a fourth secondary index, the first index operation command also includes a second primary key, and performing an operation of the first index operation type on the target index according to the first index operation command includes: According to the first index operation command, the third data corresponding to the second primary key in the second primary key index and / or the fourth secondary index is queried.

5. The method according to claim 1, characterized in that The first index operation type is a scan type, the target index includes a third primary key index and / or a fifth secondary index, and performing the operation of the first index operation type on the target index according to the first index operation command includes: According to the first index operation command, the third primary key index and / or the fifth secondary index are scanned to obtain multiple data corresponding to multiple primary keys and / or multiple secondary index keys in the third primary key index and / or the fifth secondary index.

6. An index operation device, characterized in that: The index operation device is applied to a key-value database, the key-value database stores data in the form of key-value pairs, the key-value database at least includes a primary key index, the primary key index includes at least one primary key and data corresponding to the at least one primary key, and the index operation device includes: A receiving module, configured to receive a first index operation command, wherein the first index operation command includes an index name of a target index and a first index operation type, wherein the target index includes a target primary key index and / or a target secondary index, the target primary key index includes a target primary key and target data corresponding to the target primary key, the target secondary index includes a target secondary index key and the target primary key, and the target secondary index is used by the key-value database to obtain the target primary key, and based on the target primary key, obtain the target data corresponding to the target primary key; A processing module is used to perform the operation of the first index operation type on the target index according to the first index operation command.

7. The device according to claim 6, characterized in that The first index operation type is an update type, the target index includes a first primary key index and a first secondary index, the first index operation command also includes a first primary key, and the processing module is specifically configured to: According to the first index operation command, obtain first data corresponding to the first primary key in the first primary key index; The first data is moved to the first secondary index.

8. The device according to claim 6, characterized in that The first index operation type is an update type, the target index includes a second secondary index and a third secondary index, the first index operation command also includes a first secondary index key, and the processing module is specifically used to: Reading, according to the first index operation command, second data corresponding to the first secondary index key in the second secondary index; The second data is moved to the third secondary index.

9. The device according to claim 6, characterized in that The first index operation type is a query type, the target index includes a second primary key index and / or a fourth secondary index, the first index operation command also includes a second primary key, and the processing module is specifically configured to: According to the first index operation command, the third data corresponding to the second primary key in the second primary key index and / or the fourth secondary index is queried.

10. The device according to claim 6, characterized in that The first index operation type is a scan type, the target index includes a third primary key index and / or a fifth secondary index, and the processing module is specifically configured to: According to the first index operation command, the third primary key index and / or the fifth secondary index are scanned to obtain multiple data corresponding to multiple primary keys and / or multiple secondary index keys in the third primary key index and / or the fifth secondary index.

11. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 5.

12. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 5.

Citation Information

Cited By

  • Processing method and system for automatically storing intelligent form draft, and medium

    CN120950569A