A method and device for operating data in a memory database

By obtaining in-memory database operation instructions and database table index information, the target database table and data primary key are determined, and data operations are performed based on the association relationship. This solves the cumbersome problem of accessing batch data in the in-memory database, achieves efficient data access and synchronization, and satisfies meet high performance requirements.

CN112699127BActive Publication Date: 2024-08-27MAYWIDE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011627600.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2024-08-27
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

Existing in-memory databases have the problem of cumbersome data access processes when accessing batch data, and cannot meet high-performance requirements.

Method used

By obtaining in-memory database operation instructions, including library table operation instructions and library table index information, determine the target library table and target data primary key, perform data operation processing based on the preset association relationship, and synchronize the data to the non-memory database when specific conditions are met. .

Benefits of technology

It realizes efficient operation of batch data in the memory database, simplifies the data access process, and improves the response performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112699127B
    Figure CN112699127B
Patent Text Reader

Abstract

The present application provides a method and device for operating data in a memory database, wherein the method includes: obtaining an in-memory database operation instruction, the in-memory database operation instruction including: a library table operation instruction and a library table index information; determining a target library table corresponding to the library table index information according to the library table index information; determining a target data primary key associated with the target library table according to the target library table, in combination with a preset association relationship between each library table and a data primary key; and performing data operation processing on the memory data corresponding to the target data primary key according to the library table operation instruction. The present application establishes association relationship information between a library table and a data primary key, determines a target library table and a target data primary key associated with the target library table through library table index information based on the operation mechanism of a traditional database, and implements batch operations on data in the memory database according to the target data primary key, thereby solving the technical problem that the existing in-memory database has a cumbersome data access process when accessing batch data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a method and device for operating data in an in-memory database. Background Art

[0002] With the development of big data technology, database technology has also been widely used in many fields. Some programs (such as real-time billing in the communication field) require high data read and write performance, extremely high system interaction frequency, and millisecond-level response for each interaction. Traditional databases cannot meet this performance requirement. Therefore, in-memory databases are needed. However, the data storage mechanism of in-memory databases is relatively simple, generally using simple key-value storage in the form of key / value. As a result, the existing in-memory databases have the technical problem of cumbersome data access process when accessing batch data. Summary of the invention

[0003] The present application provides a method and device for operating data in an in-memory database, which are used to solve the technical problem that when the existing in-memory database accesses batch data, the data access process is cumbersome.

[0004] First, the first aspect of the present application provides a method for operating data in an in-memory database, comprising:

[0005] Obtaining an in-memory database operation instruction, wherein the in-memory database operation instruction includes: a library table operation instruction and library table index information;

[0006] According to the library table index information, determining the target library table corresponding to the library table index information;

[0007] According to the target library table, combined with the preset association relationship between each library table and the data primary key, determine the target data primary key associated with the target library table;

[0008] According to the library table operation instruction, data operation processing is performed on the memory library data corresponding to the target data primary key.

[0009] Preferably, it also includes:

[0010] According to a preset data synchronization trigger condition, when the data synchronization trigger condition is met, the data in the memory database is synchronized to the non-memory database.

[0011] Preferably, the data synchronization triggering conditions specifically include: the interval between the current time node and the first time node is equal to a preset time interval threshold, or the cumulative value of the number of data changes reaches a preset change number threshold, wherein the first time node is the time node for the last triggering of data synchronization.

[0012] Preferably, the library table operation instructions include: deletion operation instructions, modification operation instructions and query operation instructions.

[0013] Preferably, the library table operation instruction further includes: adding operation instruction;

[0014] When the library table operation instruction is an add operation instruction, performing data operation processing on the memory library data corresponding to the target data primary key according to the library table operation instruction specifically includes:

[0015] Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions;

[0016] According to the associated data primary key contained in the memory database operation instruction, an associated relationship between the newly added library table and the associated data primary key is established, and data corresponding to the associated data primary key is stored in the memory database.

[0017] At the same time, the second aspect of the present application provides a memory database data operation device, including:

[0018] An operation instruction acquisition unit is used to acquire an in-memory database operation instruction, wherein the in-memory database operation instruction includes: a library table operation instruction and library table index information;

[0019] A target library table determining unit, used for determining a target library table corresponding to the library table index information according to the library table index information;

[0020] A target primary key determination unit, configured to determine a target data primary key associated with the target library table according to the target library table and in combination with a preset association relationship between each library table and a data primary key;

[0021] The operation processing execution unit is used to perform data operation processing on the memory library data corresponding to the target data primary key according to the library table operation instruction.

[0022] Preferably, it also includes:

[0023] The data synchronization unit is used to synchronize the data in the memory database to the non-memory database according to a preset data synchronization trigger condition when the data synchronization trigger condition is met.

[0024] Preferably, the data synchronization triggering conditions specifically include: the interval between the current time node and the first time node is equal to a preset time interval threshold, or the cumulative value of the number of data changes reaches a preset change number threshold, wherein the first time node is the time node for the last triggering of data synchronization.

[0025] Preferably, the library table operation instructions include: deletion operation instructions, modification operation instructions and query operation instructions.

[0026] Preferably, the library table operation instruction further includes: adding operation instruction;

[0027] When the library table operation instruction is an add operation instruction, the operation processing execution unit is specifically used to:

[0028] Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions;

[0029] According to the associated data primary key contained in the memory database operation instruction, an associated relationship between the newly added library table and the associated data primary key is established, and data corresponding to the associated data primary key is stored in the memory database.

[0030] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0031] The present application provides a method for operating data in a memory database, comprising: obtaining a memory database operation instruction, wherein the memory database operation instruction comprises: a library table operation instruction and library table index information; determining a target library table corresponding to the library table index information according to the library table index information; determining a target data primary key associated with the target library table according to the target library table and in combination with a preset association relationship between each library table and a data primary key; and performing data operation processing on memory data corresponding to the target data primary key according to the library table operation instruction.

[0032] The present application establishes the association relationship information between the library table and the data primary key, and based on the operation mechanism of the traditional database, determines the target library table and the target data primary key associated with the target library table through the library table index information, and implements batch operations on the data in the memory database according to the target data primary key, thereby solving the technical problem that the existing memory database has a cumbersome data access process when accessing batch data. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0034] Figure 1 A flowchart of a first embodiment of a method for operating data in a memory database provided by the present application;

[0035] Figure 2 A flowchart of a second embodiment of a method for operating data in a memory database provided by the present application;

[0036] Figure 3 A schematic structural diagram of a first embodiment of a memory database data operation device provided in the present application. DETAILED DESCRIPTION

[0037] The embodiments of the present application provide a method and device for operating data in an in-memory database, which are used to solve the technical problem that when an existing in-memory database accesses batch data, the data access process is complicated.

[0038] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0039] See also Figure 1 The first embodiment of the present application provides a method for operating data in a memory database, comprising:

[0040] Step 101: Obtain in-memory database operation instructions, which include: library table operation instructions and library table index information.

[0041] Step 102: Determine the target library table corresponding to the library table index information according to the library table index information.

[0042] Step 103: According to the target library table, in combination with the preset association relationship between each library table and the data primary key, determine the target data primary key associated with the target library table.

[0043] Step 104: According to the library table operation instruction, data operation processing is performed on the memory library data corresponding to the target data primary key.

[0044] It should be noted that the memory database operation instruction is obtained according to the memory database operation instruction generated when the user operates the memory database when using the upper layer application.

[0045] According to the library table index information contained in the memory database operation instruction, the target library table corresponding to the library table index information is determined, and then the target data primary key associated with the target library table is determined in combination with the association relationship between each library table and the data primary key, and then the memory library data corresponding to the target data primary key is subjected to data operation processing corresponding to the library table operation instruction.

[0046] The present application establishes the association relationship information between the library table and the data primary key, and based on the operation mechanism of the traditional database, determines the target library table and the target data primary key associated with the target library table through the library table index information, and implements batch operations on the data in the memory database according to the target data primary key, thereby solving the technical problem that the existing memory database has a cumbersome data access process when accessing batch data.

[0047] The above is a detailed description of the first embodiment of a method for operating data in an in-memory database provided by the present application. The following is a detailed description of the second embodiment of a method for operating data in an in-memory database provided by the present application.

[0048] See also Figure 2 The second embodiment of the present application provides a method for operating data in an in-memory database based on the first embodiment described above.

[0049] On the basis of step 101 to step 104 proposed in the first embodiment, further, after step 104 of the first embodiment, the following may be further included:

[0050] Step 105: According to a preset data synchronization trigger condition, when the data synchronization trigger condition is met, the data in the memory database is synchronized to the non-memory database.

[0051] The data in the memory database is synchronized to the non-memory database to achieve persistent storage of data.

[0052] More specifically, the data synchronization trigger conditions mentioned in this embodiment may include the following two methods: one is when the interval between the current time node and the first time node is equal to the preset time interval threshold, where the first time node is the time node for the last triggering of data synchronization; the other is that the cumulative value of the number of data changes reaches the preset change number threshold.

[0053] The specific data synchronization process can be found in the following explanation example: By starting three threads, thread 1 and thread 2 correspond to the above two data synchronization trigger conditions:

[0054] Thread 1:

[0055] Every 1 second, the loop determines whether the number of records in the instance set to be synchronized is greater than or equal to the specified value (change quantity threshold). If the condition is met, the data in the memory database is synchronized to the non-memory database to complete the data synchronization;

[0056] Thread 2:

[0057] The data in the memory database is synchronized to the non-memory database at a specified time interval (time interval threshold).

[0058] Furthermore, the library table operation instructions include: deletion operation instructions, modification operation instructions and query operation instructions.

[0059] Further, the library table operation instructions also include: adding operation instructions;

[0060] Compared with the above three operation instructions, the add operation instruction for adding new data is more special. When the library table operation instruction is an add operation instruction, according to the library table operation instruction, the data operation processing of the memory library data corresponding to the primary key of the target data specifically includes:

[0061] Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions;

[0062] According to the associated data primary key contained in the memory database operation instruction, an association relationship between the newly added library table and the associated data primary key is established, and the data corresponding to the associated data primary key is stored in the memory database.

[0063] Through the library table operation instructions mentioned above, combined with the memory database data operation method mentioned in this application, the addition, deletion, modification and query operations of the memory database can be realized.

[0064] The above is a detailed description of the second embodiment of a memory database data operation method provided by the present application. The following is a detailed description of the first embodiment of a memory database data operation device provided by the present application.

[0065] See also Figure 3 The third embodiment of the present application provides a memory database data operation device, including:

[0066] The operation instruction acquisition unit 201 is used to acquire the memory database operation instruction, and the memory database operation instruction includes: library table operation instruction and library table index information;

[0067] The target library table determining unit 202 is used to determine the target library table corresponding to the library table index information according to the library table index information;

[0068] The target primary key determination unit 203 is used to determine the target data primary key associated with the target library table according to the target library table and in combination with the preset association relationship between each library table and the data primary key;

[0069] The operation processing execution unit 204 is used to perform data operation processing on the memory library data corresponding to the target data primary key according to the library table operation instruction.

[0070] Furthermore, it also includes:

[0071] The data synchronization unit 205 is used to synchronize the data in the memory database to the non-memory database according to a preset data synchronization trigger condition when the data synchronization trigger condition is met.

[0072] Furthermore, the data synchronization triggering conditions specifically include: the interval between the current time node and the first time node is equal to a preset time interval threshold, or the cumulative value of the number of data changes reaches a preset change number threshold, where the first time node is the time node that last triggered data synchronization.

[0073] Furthermore, the library table operation instructions include: deletion operation instructions, modification operation instructions and query operation instructions.

[0074] Further, the library table operation instructions also include: adding operation instructions;

[0075] When the library table operation instruction is an add operation instruction, the operation processing execution unit is specifically used for:

[0076] Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions;

[0077] According to the associated data primary key contained in the memory database operation instruction, an association relationship between the newly added library table and the associated data primary key is established, and the data corresponding to the associated data primary key is stored in the memory database.

[0078] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0079] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0080] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0081] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0082] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0083] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0084] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application 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 deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for operating data in a memory database, characterized in that: include: Obtaining an in-memory database operation instruction, wherein the in-memory database operation instruction includes: a library table operation instruction and library table index information, wherein the library table operation instruction includes: a delete operation instruction, a change operation instruction, a query operation instruction, and an add operation instruction; According to the library table index information, determining the target library table corresponding to the library table index information; According to the target library table, combined with the preset association relationship between each library table and the data primary key, determine the target data primary key associated with the target library table; According to the library table operation instruction, data operation processing is performed on the memory library data corresponding to the target data primary key; When the library table operation instruction is an add operation instruction, performing data operation processing on the memory library data corresponding to the target data primary key according to the library table operation instruction specifically includes: Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions; According to the associated data primary key contained in the memory database operation instruction, an associated relationship between the newly added library table and the associated data primary key is established, and data corresponding to the associated data primary key is stored in the memory database.

2. The method for operating data in a memory database according to claim 1, characterized in that: Also includes: According to a preset data synchronization trigger condition, when the data synchronization trigger condition is met, the data in the memory database is synchronized to the non-memory database.

3. The method for operating data in a memory database according to claim 2, characterized in that: The data synchronization triggering conditions specifically include: the interval between the current time node and the first time node is equal to a preset time interval threshold, or the cumulative value of the number of data changes reaches a preset change number threshold, wherein the first time node is the time node of the last triggering of data synchronization.

4. A memory database data operation device, characterized in that: include: An operation instruction acquisition unit is used to acquire an in-memory database operation instruction, wherein the in-memory database operation instruction includes: a library table operation instruction and library table index information, and the library table operation instruction includes: a delete operation instruction, a change operation instruction, a query operation instruction, and an add operation instruction; A target library table determining unit, used for determining a target library table corresponding to the library table index information according to the library table index information; A target primary key determination unit, configured to determine a target data primary key associated with the target library table according to the target library table and in combination with a preset association relationship between each library table and a data primary key; The operation processing execution unit is used to perform data operation processing on the memory library data corresponding to the target data primary key according to the library table operation instruction; when the library table operation instruction is an add operation instruction, the operation processing execution unit is specifically used to: Create a new library table according to the library table operation instructions and library table information contained in the memory database operation instructions; According to the associated data primary key contained in the memory database operation instruction, an associated relationship between the newly added library table and the associated data primary key is established, and data corresponding to the associated data primary key is stored in the memory database.

5. The in-memory database data operation device according to claim 4, characterized in that: Also includes: The data synchronization unit is used to synchronize the data in the memory database to the non-memory database according to a preset data synchronization trigger condition when the data synchronization trigger condition is met.

6. The in-memory database data operation device according to claim 5, characterized in that: The data synchronization triggering conditions specifically include: the interval between the current time node and the first time node is equal to a preset time interval threshold, or the cumulative value of the number of data changes reaches a preset change number threshold, wherein the first time node is the time node of the last triggering of data synchronization.