A data operation method and device, computer device and storage medium

By merging data operation requests in the database and creating indexes/views, the problems of low database operation efficiency and poor flexibility are solved, achieving more efficient data processing and querying.

CN114595242BActive Publication Date: 2025-11-04DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210213047.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-04
Publication Date
2025-11-04
Estimated Expiration
2042-03-04

AI Technical Summary

Technical Problem

Existing database operation methods are inefficient and lack flexibility, especially when receiving multiple data operation requests in succession, which consumes a lot of resources and takes too long to process.

Method used

When the waiting time threshold or the number of requests reaches a threshold, multiple data operation requests are merged into a target request for batch processing, and database indexes or query views are created as necessary to improve efficiency and flexibility.

Benefits of technology

Batch processing and index/view creation improve the efficiency and flexibility of database operations, avoid excessive processing time, and enhance database utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114595242B_ABST
    Figure CN114595242B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data operation method and device, computer device and storage medium, wherein the method comprises: in response to receiving a data operation request for a database, if it is determined that there is a new data operation request with the same data operation type as the data operation request within the waiting time threshold corresponding to the database, waiting to receive the new data operation request; in the case where it is determined that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold, merging a plurality of data operation requests that have been received and not processed into a target data operation request; performing data operation corresponding to the target data operation request to obtain a data operation result; wherein the data operation result comprises data operation results for the plurality of data operation requests before merging.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of database, and in particular, to a data operation method and device, computer equipment and storage medium. BACKGROUND

[0002] As a warehouse for organizing, storing and managing data according to data structure, database plays an important role in computer technology. When using the database, the user can operate the data in the database by inputting various types of database instructions, such as querying data, deleting data, etc. However, the existing database usage mode has the problems of low library usage efficiency and poor flexibility. SUMMARY

[0003] The present disclosure provides at least a data operation method and device, computer equipment and storage medium.

[0004] In a first aspect, the present disclosure provides a data operation method, comprising:

[0005] In response to receiving a data operation request for a database, if it is determined that there is a new data operation request with the same data operation type as the data operation request within a waiting time threshold corresponding to the database, the new data operation request is waited for to be received;

[0006] In a case where it is determined that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold, a plurality of data operation requests that have been received and not processed are merged into a target data operation request;

[0007] Performing a data operation corresponding to the target data operation request to obtain a data operation result; wherein the data operation result includes a data operation result for the plurality of data operation requests before merging.

[0008] In a possible implementation, the data operation type includes one of a data query type, a data modification type, a data insertion type and a data deletion type.

[0009] In a possible implementation, the performing a data operation corresponding to the target data operation request to obtain a data operation result comprises:

[0010] In a case where the data operation type includes a data query type, it is determined whether there is a database index matching a query condition corresponding to the target data operation request;

[0011] In a case where it is determined that there is a database index matching the query condition, a plurality of target data matching the target data operation request is obtained from the database by using the database index; or

[0012] In a case where it is determined that there is no database index matching the query condition, a plurality of target data matching the target data operation request is obtained from the database according to the query condition.

[0013] In a possible implementation, the method further comprises:

[0014] In a case where it is determined that there is no database index matching the query condition, a target index for the target data is created and stored.

[0015] In a possible implementation, creating a target index for the target data comprises:

[0016] A preset index creation condition is obtained; the index creation condition is used to indicate a time at which an index is allowed to be created, and in a case where the time indicated by the index creation condition is reached, the target index is created according to the query condition.

[0017] In a possible implementation, the database comprises a plurality of data tables, and in a case where the data operation type comprises a data query type, after the data operation result corresponding to the target data operation request is determined, the method further comprises:

[0018] In a case where the data operation result comprises target data queried from a plurality of data tables, a query view is created, and a plurality of target data corresponding to the data operation result is stored in the query view.

[0019] In a possible implementation, the method further comprises a step of determining a waiting time threshold corresponding to the database:

[0020] A preset artificial intelligence (AI) data module is used to determine a target time period in which an initiation time of the data operation request is located from a plurality of preset time periods;

[0021] A preset time threshold corresponding to the target time period is taken as the waiting time threshold corresponding to the database.

[0022] In a possible implementation, the method further comprises a step of determining whether the new data operation request exists:

[0023] The preset AI data module is used to determine a request receiving frequency of the data operation type in the target time period based on a target time period corresponding to an initiation time of the data operation request, the data operation type corresponding to the data operation request, and a predetermined frequency mapping relationship. The frequency mapping relationship is determined by the AI data module based on historical operation requests for the database collected in a plurality of preset time periods. The frequency mapping relationship is used to represent a request receiving frequency of each data operation type in each preset time period.

[0024] The request receiving frequency corresponding to the target time period is determined, and it is determined whether the new data operation request exists.

[0025] In a second aspect, the embodiments of the present disclosure further provide a data operation device, comprising:

[0026] A determination module is configured to, in response to receiving a data operation request for a database, determine whether there is a new data operation request with the same data operation type as the data operation request within a waiting time threshold corresponding to the database, and wait to receive the new data operation request.

[0027] A merging module is configured to, in a case where the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold, merge a plurality of data operation requests that have been received and not processed into a target data operation request.

[0028] An execution module is configured to execute a data operation corresponding to the target data operation request to obtain a data operation result. The data operation result includes data operation results of the plurality of data operation requests before merging.

[0029] In a possible implementation, the data operation type includes one of a data query type, a data modification type, a data insertion type, and a data deletion type.

[0030] In a possible implementation, the execution module is configured to, in a case where the data operation type includes a data query type, determine whether there is a database index matching a query condition corresponding to the target data operation request.

[0031] In a case where it is determined that there is a database index matching the query condition, the database index is used to obtain a plurality of target data matching the target data operation request from the database; or

[0032] In a case where it is determined that there is no database index matching the query condition, the query condition is used to obtain a plurality of target data matching the target data operation request from the database.

[0033] In a possible implementation, the apparatus further includes:

[0034] The first creating module is configured to create and store a target index for the target data in a case where it is determined that there is no database index matching the query condition.

[0035] In a possible implementation, the first creating module is configured to acquire a preset index creating condition; the index creating condition is used to indicate a time at which an index is allowed to be created, and the target index is created according to the query condition in a case where the time indicated by the index creating condition is reached.

[0036] In a possible implementation, the database includes a plurality of data tables, and the apparatus further includes:

[0037] The second creating module is configured to create a query view and store a plurality of target data corresponding to the data operation result in association in the query view in a case where the data operation result includes the target data queried from the plurality of data tables after the determining the data operation result corresponding to the target data operation request.

[0038] In a possible implementation, the determining module is further configured to determine the waiting time threshold corresponding to the database according to the following steps:

[0039] acquire a target time period in which an initiation time of the data operation request is located, from a plurality of preset time periods, by using a preset artificial intelligence (AI) data module;

[0040] determine a preset time threshold corresponding to the target time period as the waiting time threshold corresponding to the database.

[0041] In a possible implementation, the determining module is further configured to determine whether the new data operation request exists according to the following steps:

[0042] determine a request receiving frequency corresponding to the target time period of the initiation time of the data operation request, a data operation type corresponding to the data operation request, and a predetermined frequency mapping relationship, by using a preset AI data module; the frequency mapping relationship is determined by the AI data module according to historical operation requests for the database collected in a plurality of preset time periods, and the frequency mapping relationship is used to represent a request receiving frequency of each data operation type in each preset time period;

[0043] determine whether the new data operation request exists according to the determined request receiving frequency corresponding to the target time period.

[0044] In a third aspect, the optional implementation of the present disclosure further provides a computer device, a processor and a memory, wherein the memory stores machine readable instructions executable by the processor, and the processor is configured to execute the machine readable instructions stored in the memory, and the machine readable instructions are configured to perform the steps of the first aspect or any possible implementation of the first aspect when executed by the processor.

[0045] In a fourth aspect, the optional implementation of the present disclosure further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is configured to perform the steps of the first aspect or any possible implementation of the first aspect when executed.

[0046] The effects of the data operation apparatus, the computer device and the computer readable storage medium are described above in the description of the data operation method, and thus are not described here again.

[0047] The data operation method, the apparatus, the computer device and the storage medium provided by the embodiments of the present disclosure can automatically batch process the received data operation requests by waiting to receive a new data operation request, and automatically merging the received data operation requests into a target data operation request and responding to the target data operation request when it is determined that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold. Compared with processing each received data operation request individually, the batch processing method can improve the efficiency of data operation on the database, i.e., improve the database usage efficiency. In addition, when the number of data operation requests corresponding to the target data operation request is determined by the waiting time threshold or the number of received data operation requests, the batch processing method can improve the rationality and flexibility of the delayed processing of the received data operation requests, and avoid the problem of too long processing time caused by too many batch processing data operation requests, thereby effectively improving the database usage efficiency.

[0048] Further, the data operation method, the apparatus, the computer device and the storage medium provided by the embodiments of the present disclosure can automatically create a target index for a plurality of target data corresponding to the target data operation request when there is no database index matching the query condition corresponding to the target data operation request. In this way, if a new data operation request for the target data is received after the target index is created, the target data can be quickly searched and operated based on the target index, thereby improving the efficiency of data operation.

[0049] Further, the data operation method, device, computer device and storage medium provided by the embodiments of the present disclosure can also create a query view capable of associatively storing the target data corresponding to the data operation result in the case that the data operation result comprises target data queried from the plurality of data tables. In this way, if a new data operation request for the target data is received after the query view is created, the target data does not need to be searched from the plurality of data tables again, and the target data can be directly searched and operated based on the query view, thereby effectively improving the efficiency of data operation.

[0050] In order to make the above objectives, characteristics and advantages of the present disclosure more apparent, clear and easy to understand, the following will specifically describe the preferred embodiments in conjunction with the accompanying drawings, and make a detailed description as follows. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments. The drawings herein are incorporated into the specification and form a part of the specification, which show the embodiments consistent with the present disclosure, and are used to explain the technical solutions of the present disclosure together with the specification. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as a limitation to the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0052] Figure 1 A flow chart of a data operation method provided by the embodiments of the present disclosure is shown;

[0053] Figure 2 A specific implementation flow chart of a data operation provided by the embodiments of the present disclosure is shown;

[0054] Figure 3 A schematic diagram of a data operation device provided by the embodiments of the present disclosure is shown;

[0055] Figure 4 A structure schematic diagram of a computer device provided by the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0056] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the following will be combined with the accompanying drawings of the embodiments of the present disclosure to make the technical solutions in the embodiments of the present disclosure clearly and completely understood. Obviously, the described embodiments are only a part of the embodiments of the present disclosure and not all the embodiments. The components of the embodiments of the present disclosure described and shown herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work belong to the scope of protection of the present disclosure.

[0057] In addition, the terms "first", "second", and the like in the specification and claims of the embodiments of the present disclosure and the above-described accompanying drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.

[0058] "Multiple or several" referred to herein means two or more. "And / or" describes the association between the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the associated objects before and after are in an "or" relationship.

[0059] It is found through research that, in response to a user input database instruction, a common response mode is to receive a data instruction, that is, to respond to one instruction. Each response to a database instruction requires the use of certain database resources and takes a certain processing time. If there are multiple database instructions continuously within a certain period of time, the above response mode requires occupation of more database resources and takes more processing time, which not only reduces the flexibility of instruction response, but also affects the use efficiency of the database.

[0060] Based on the above research, this disclosure provides a data operation method, apparatus, computer device, and storage medium. When a new data operation request is received within a determined waiting time threshold, the method automatically merges multiple currently received and unprocessed data operation requests into a target data operation request and responds to the target operation request when the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold. This enables automatic batch processing of multiple received data operation requests. Compared to processing each received data operation request individually, batch processing improves the efficiency of data operations on the database, thus increasing database utilization efficiency. Furthermore, when the number of merged data operation requests corresponding to the target data operation request is determined by the waiting time threshold or the number of received data operation requests, this method improves the rationality and flexibility of delaying the processing of received data operation requests and avoids the problem of excessive processing time due to an excessive number of batch data operation requests, effectively improving database utilization efficiency.

[0061] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.

[0062] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0063] To facilitate understanding of this embodiment, a data operation method disclosed in this disclosure will first be described in detail. The execution subject of the data operation method provided in this disclosure is generally a computer device with certain computing capabilities. In some possible implementations, the data operation method can be implemented by the processor calling computer-readable instructions stored in the memory.

[0064] The data operation method provided in this disclosure embodiment will be described below using a computer device as an example.

[0065] like Figure 1 The flowchart shown is a data manipulation method provided in an embodiment of this disclosure, which may include the following steps:

[0066] S101: In response to receiving a data operation request for the database, if it is determined that within the waiting time threshold corresponding to the database, there exists a new data operation request with the same data operation type as the data operation request, then wait to receive the new data operation request.

[0067] Here, the data operation request is a request initiated by a user for operating data in the database, and specifically, the data operation request can be initiated in the form of a message. Different data operation requests can correspond to different data operation types.

[0068] The database can be a pre-established database, which can include one or more pieces of data. For example, in the case of a database for class student information, the database can include basic information of multiple students, such as name, age, address, contact information, and the like.

[0069] The data operation type is an operation required to be performed on the data in the database. In specific implementation, the data operation type can include, but is not limited to, a data query type, a data modification type, a data insertion type, and a data deletion type. Various data operation types corresponding to the database can all fall within the protection scope of the present disclosure, which is not limited here.

[0070] The data operation request of the data query type is used to query the required data from the database, the data operation request of the data modification type is used to modify the data in the database, the data operation request of the data insertion type is used to insert data into the database, and the data operation request of the data deletion type is used to delete the data in the database.

[0071] The waiting time threshold is a pre-determined maximum waiting time length for responding to the data operation request after receiving the data operation request, that is, a maximum delay response time length for receiving the data operation request. For example, the waiting time threshold can be 30 seconds, 10 seconds, and the like. The waiting time threshold can include one or more, for example, the waiting time thresholds corresponding to data operation requests with different data operation types are different, and for example, the waiting time thresholds corresponding to different time ranges are different.

[0072] The new data operation request is a request with the same data operation type as the received data operation request, for example, in the case of a data operation request being a query operation request, the new data operation request is also a query operation request.

[0073] In specific implementation, after receiving the data operation request for the database, the waiting time threshold corresponding to the database can be determined first, for example, the waiting time threshold is determined according to the received data operation request. Then, it is determined whether there is a new data operation request with the same data operation type as the received data operation request within the waiting time threshold. If yes, the received data operation request is waited to be executed, and the new data operation request is waited to be received.

[0074] If no, the received data operation request can be directly responded to, a data operation corresponding to the received data operation request is performed, a data operation result is obtained, for example, target data is queried.

[0075] S102: In a case where the waiting time reaches a waiting time threshold or the number of received data operation requests reaches a preset threshold, a plurality of data operation requests that have been received and not processed are merged into a target data operation request.

[0076] Here, the waiting time is a time length experienced from receiving the above-mentioned data operation request for the database to the current time. In the waiting time, no new data operation request can be received, or one or more new data operation requests can be received. The preset threshold is the maximum number of received data operation requests. The received data operation requests include the above-mentioned data operation request for the database and the received new data operation request. The received data operation requests are all unprocessed data operation requests.

[0077] In the specific implementation of this step, if it is determined that the waiting time reaches the waiting time threshold and the number of received data operation requests does not reach the preset threshold, the received and unprocessed data operation requests are merged into the target data operation request. For example, according to the query conditions corresponding to each received data operation request, the target data operation request including a plurality of different query conditions is obtained.

[0078] Alternatively, if the number of received data operation requests reaches the preset threshold, whether the waiting time reaches the waiting time threshold or not, the waiting is stopped, and the received and unprocessed data operation requests are merged into the target data operation request. In this way, by using the waiting time threshold to determine the merging time or using the preset threshold to determine the merging time, the merging of the received data operation requests can be flexibly implemented, and the flexibility of batch processing data operation requests is improved.

[0079] S103: A data operation corresponding to the target data operation request is performed to obtain a data operation result; wherein the data operation result includes data operation results of the plurality of data operation requests before merging.

[0080] In the specific implementation, the target data operation request is responded to, a data operation corresponding to the target data operation request is performed, and a data operation result corresponding to each data operation request in the plurality of data operation requests before merging is obtained. The data operation result is the result obtained by operating the data in the database according to the target data operation request.

[0081] For example, target data corresponding to each of the data operation requests before merging is found from the database according to the query condition corresponding to the target data operation request, and for example, target data corresponding to each of the data operation requests before merging is deleted from the database according to the deletion condition corresponding to the target data operation request.

[0082] In this way, when it is determined that there is a new data operation request within the waiting time threshold, the new data operation request is received, and when it is determined that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches the preset threshold, the plurality of data operation requests that have been received and not processed are automatically merged into a target data operation request, and the target operation request is responded to. The way can realize the batch processing of the received plurality of data operation requests. Compared with processing each received data operation request separately, the batch processing method is beneficial to improve the efficiency of data operation on the database, that is, to improve the library usage efficiency. And in the case where the number of data operation requests corresponding to the target data operation request is determined by the waiting time threshold or the number of received data operation requests, the rationality and flexibility of the delay processing of the received data operation requests can be improved, and the problem of too long processing time caused by too many batch processing data operation requests can be avoided, and the library usage efficiency is effectively improved.

[0083] In an embodiment, in the case where the data operation type corresponding to the received data operation request includes a data query type, different data operation requests can correspond to different query conditions, and the query condition is used to find target data from the database. For example, the query condition corresponding to the data operation request 1 can be a request to query information corresponding to a user A with a user name, and the query condition corresponding to the data operation request 2 can be a request to query information corresponding to a user B with a user name.

[0084] For S103, it can be determined from each database index established in the database whether there is a database index matching the query condition corresponding to the target data operation request. In the case where it is determined that there is a database index matching the query condition, the database index can be used to obtain a plurality of target data matching the target data operation request from the database.

[0085] On the contrary, in the case where it is determined that there is no database index matching the query condition, it is necessary to sequentially find data in the database according to the query condition until a plurality of target data matching the target data operation request is obtained from the database.

[0086] In a case where the target data operation request is a merged request of multiple received and unprocessed requests, the query condition corresponding to the target data operation request can include the query conditions corresponding to the multiple data operation requests before the merging. Further, for each query condition corresponding to the target data operation request, it can be determined whether there is a database index matching the query condition from the database indexes established in the database.

[0087] Further, for each query condition, in a case where it is determined that there is a database index corresponding to the query condition, the data corresponding to the query condition can be obtained from the database by using the database index, and the data can be taken as a target data matching the target data operation request.

[0088] For each query condition for which there is no corresponding database index, the data in the database needs to be sequentially searched until the data corresponding to the query condition is obtained from the database, and the data can be taken as a target data matching the target data operation request.

[0089] Alternatively, in a case where the target data operation request is a merged request of multiple received and unprocessed requests, the query conditions corresponding to the multiple data operation requests before the merging can be merged into one query condition, and the target data matching the target data operation request can be searched from the database based on the query condition.

[0090] In an embodiment, in a case where it is determined that there is no database index matching the query condition, a target index for the target data corresponding to the query condition can be created and stored according to the query condition. Here, in a case where the query condition for which there is no corresponding database index includes multiple query conditions, one target index for multiple target data can be created and stored according to the multiple query conditions for which there is no corresponding database index. Here, the multiple target data corresponding to the target index includes the target data corresponding to the multiple query conditions for which there is no corresponding database index.

[0091] In a case where the query condition corresponding to the target data operation request includes only one query condition, and the query condition has no matching database index, a target index for multiple target data matching the target data operation request can be created according to the query condition, and the target index can be stored.

[0092] In addition, after the target index is created, each data related to the target index except for the target data can also be searched from the database, and each related data can be taken as the data corresponding to the target index together with the target data.

[0093] Alternatively, when searching for the target data using the database index corresponding to the query condition, if a long search time is required, it indicates that the index effect of the database index is not ideal. Therefore, a target index for the target data can be created according to the query condition. In addition, the database index with an undesirable index effect can be automatically deleted.

[0094] In this way, by creating a new target index, the target data required can be quickly searched from the database using the target index after receiving a new data operation request, thereby further improving the database usage efficiency.

[0095] In an embodiment, for the process of creating a target index, after determining that a new target index needs to be created, a preset index creation condition can be obtained. Here, the index creation condition is used to indicate the time when the index is allowed to be created. Specifically, the index creation time can be a time when the available database processing resources are more. For example, 22:00 to 6:00 the next morning. The index creation condition can be a condition preset by a developer, and the specific index creation condition can be set according to the actual needs of using the database. Here, no limitation is made.

[0096] Further, it can be determined whether the current time meets the index creation condition. If yes, the target index for the target data can be directly created according to the query condition. If no, the target index for the target data needs to be created according to the query condition when the time indicated by the index creation condition is reached.

[0097] In another embodiment, when creating a target index, it can be determined whether there is a database index consistent with the target index to be created in the established database index corresponding to the database, and the target index is created when it is determined that there is no such database index.

[0098] In this way, the creation of the target index using the set index creation condition can avoid the problem of occupying the available database processing resources and affecting the use of the database when the target index is directly created, thereby improving the user experience.

[0099] In an embodiment, the database can include a plurality of data tables, each data table can be created in a different application scenario, and the data stored in each data table is different. Specifically, each data table can have a certain amount of overlapping data and a certain amount of different data.

[0100] In a case where the data operation type corresponding to the data operation request comprises a data query type, the data operation request can be a joint query request, which is used to find target data from multiple data tables of the database. For example, information corresponding to a user with a user name XXX is queried from a data table 1, and information corresponding to a user with a same user name XXX is queried from a data table 2.

[0101] In this embodiment, the data operation result corresponding to the target data operation request can comprise target data queried from the multiple data tables, and in this case, a query view can also be created based on the target data respectively queried from the multiple data tables. The query view is used to store the target data queried from the multiple data tables in association.

[0102] Here, after a new joint query request is subsequently received, the target data can be directly found from the query view, avoiding the operation of sequentially querying from the multiple data tables, thereby effectively improving the use efficiency of the database.

[0103] For example, in a case where the target data operation request corresponds to multiple joint query requests before merging, target data corresponding to a query condition of each joint query request can be queried from multiple data tables according to the query condition, and a query view corresponding to the query condition can be created according to the target data corresponding to the query condition. In this way, multiple query views corresponding to the target data operation request can be obtained.

[0104] Alternatively, after obtaining the target data from the multiple data tables corresponding to each joint query request, a query view corresponding to the target data operation request can also be created according to the target data from the multiple data tables.

[0105] In a case where it is determined that the query view needs to be created, a preset view creation condition can also be obtained, and the view creation condition is used to indicate a time when the view is allowed to be created. Specifically, the view creation time can be a time when more database processing resources are available. For example, 23:00 of a day to 3:00 of the next morning.

[0106] Further, in a case where it is determined that the time indicated by the view creation condition is reached, a query view can be created according to the target data respectively queried from the multiple data tables, and the view can be stored.

[0107] Alternatively, in a case where it is determined that the query view needs to be created, the current available database processing resource corresponding to the database can also be calculated, and in a case where it is determined that the current available database processing resource supports the creation of the query view, the view is created. Otherwise, the operation of creating the view is waited to be executed until it is determined that the current available database processing resource supports the creation of the query view, and the operation of creating the view is executed.

[0108] In addition, in a case where the database has an established query view, if it is determined that the query effect of the established query view is poor according to the target data operation request, the established query view can also be automatically deleted.

[0109] Alternatively, in a case where it is determined that the query condition corresponds to a joint query request, it can be determined from the established query view whether there is a target query view matching the query condition, and if so, the target data corresponding to the query condition can be obtained from the target query view; if not, the target data corresponding to the query condition needs to be queried from multiple data tables. And in a case where the established query view does not match the query condition for multiple times, it can be determined that the query effect of the established query view is poor, and the established query view can be automatically deleted.

[0110] In an embodiment, the data operation method provided by the present disclosure further includes the step of determining the waiting time threshold corresponding to the database:

[0111] Step one, using a preset AI data module, determine the target time period in which the data operation request is initiated from a plurality of preset time periods.

[0112] For example, the plurality of preset time periods can be 9:01-23:00 and 23:01-9:00 the next day. Specifically, the number of preset time periods can be determined according to actual library usage requirements, which is not limited here. Different preset time periods can correspond to different preset time thresholds. The correspondence between the preset time period and the preset time threshold can be set according to experience. AI is Artificial Intelligence, AI data module is a pre-set module, which is used to process the received data operation request.

[0113] In specific implementation, after receiving the data operation request for the database, the data operation request can be sent to the AI data module, and the AI data module is used to determine the target time period in which the data operation request is initiated from a plurality of preset time periods. Then, the preset time threshold corresponding to the target time period is determined, and the preset time threshold is taken as the waiting time threshold corresponding to the database.

[0114] In an embodiment, each step of each of the above embodiments can be performed by using the AI data module.

[0115] In an embodiment, the data operation method provided by the embodiments of the present disclosure further includes a step of determining whether there is a new data operation request:

[0116] By using the preset AI data module, the request receiving frequency of the data operation type in the target time period can be determined based on the target time period corresponding to the initiation time of the data operation request, the data operation type corresponding to the data operation request, and the pre-determined frequency mapping relationship.

[0117] The frequency mapping relationship is determined by the AI data module based on historical operation requests for the database collected in a plurality of preset time periods, and is used to represent the request receiving frequency of each data operation type in each preset time period. The historical operation request is each historical data operation request for the database.

[0118] Specifically, the AI data module can be used to collect data operation requests for the database, and determine the request receiving frequency of each data operation type in each preset time period based on the request time, data operation type, and each preset time period corresponding to each data operation request, i.e., to determine the frequency mapping relationship.

[0119] After determining the frequency mapping relationship, if a data operation request for the database is received, the target time period corresponding to the data operation request can be determined based on the initiation time of the data operation request, and then the request receiving frequency of the target time period can be determined based on the frequency mapping relationship, the data operation type corresponding to the data operation request, and the target time period.

[0120] Then, whether there is a new data operation request can be determined based on the determined request receiving frequency of the target time period. For example, if the request receiving frequency of the target time period is greater than a preset frequency, it is determined that there is a new data operation request; otherwise, it is determined that there is no new data operation request.

[0121] In addition, in the process of determining the frequency mapping relationship, the first utilization rate of each database index established in the database can be determined based on the data operation request with the data query type in the collected data operation request, and the database index with a first utilization rate less than a first preset value can be deleted. Similarly, in the process of determining the frequency mapping relationship, the second utilization rate of each query view established in the database can be determined based on the joint query request in the collected data operation request, and the query view with a second utilization rate less than a second preset value can be deleted.

[0122] Also, for the operation of establishing a query view by using the AI data module, in the process of determining the frequency mapping relationship, it can also be determined according to the joint query request in the collected data operation request whether the query view corresponding to the joint query request is allowed to be established when each joint query request is initiated. And in the case that each joint query request corresponds to the establishment of a query view, it can be determined that the joint query request to the database needs to establish a query view. In this way, after determining the frequency mapping relationship, if a data operation request to the database is received and it is determined that the data operation request is a joint query request, the AI data module can be used to automatically establish a query view corresponding to the joint query request.

[0123] As shown in Figure 2 , a specific implementation flowchart of a data operation provided by an embodiment of the present disclosure can include the following steps

[0124] S201: Determine whether there is a new data operation request with the same data operation type as the received data operation request by using the AI data module.

[0125] Specifically, in response to receiving a data operation request to the database, the AI data module can be used to determine whether there is a new data operation request with the same data operation type as the data operation request within the waiting time threshold corresponding to the database.

[0126] If no, perform S202; if yes, perform S203.

[0127] S202: Perform the data operation corresponding to the data operation request to obtain a data operation result.

[0128] S203: Wait to receive a new data operation request, and in the case that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches the preset threshold, combine the multiple data operation requests that have been received and not processed into a target data operation request.

[0129] S204: In the case that the data operation type includes a data query type, determine whether there is a database index that matches the query condition corresponding to the target data operation request.

[0130] If yes, perform S205; if no, perform S206.

[0131] S205: Use the database index to obtain multiple target data from the database that matches the target data operation request.

[0132] S206: Obtain multiple target data from the database that matches the target data operation request.

[0133] Here, after S206 is completed, S207 and / or S209 can be executed.

[0134] S207: After acquiring multiple target data, determine whether to allow the creation of a new target index.

[0135] Here, you can preset whether the AI ​​data module is allowed to automatically create new indexes. If yes, execute S208; if no, do not create a new target index and end the process.

[0136] S208: Create and store the target index for the target data.

[0137] S209: If the multiple target data obtained that match the target data operation request include target data queried from multiple data tables, determine whether to allow the creation of a new query view.

[0138] Here, there is no strict sequential execution order between this step and S207; they can be executed simultaneously. Additionally, it can be pre-defined whether the AI ​​data module is allowed to automatically create new query views. If yes, then execute S210; if no, then do not create new query views and end the process.

[0139] S210: Create a query view and store the target data retrieved from multiple data tables in the query view.

[0140] For the specific implementation process of S201 to S210 above, please refer to the above embodiments, which will not be repeated here.

[0141] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0142] Based on the same inventive concept, this disclosure also provides a data operation device corresponding to the data operation method. Since the principle of the device in this disclosure for solving the problem is similar to the data operation method described above in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0143] like Figure 3 The diagram shown is a schematic representation of a data manipulation apparatus provided in an embodiment of this disclosure, comprising:

[0144] The determination module 301 is used to respond to receiving a data operation request for the database, and if it is determined that within the waiting time threshold corresponding to the database, there is a new data operation request with the same data operation type as the data operation request, then wait to receive the new data operation request.

[0145] The merging module 302 is configured to merge a plurality of data operation requests that have been received and not processed into a target data operation request, in a case where the waiting time reaches the waiting time threshold or the number of received data operation requests reaches the preset threshold.

[0146] The execution module 303 is configured to perform a data operation corresponding to the target data operation request to obtain a data operation result, wherein the data operation result includes a data operation result for the plurality of data operation requests before merging.

[0147] In a possible implementation, the data operation type includes one of a data query type, a data modification type, a data insertion type, and a data deletion type.

[0148] In a possible implementation, the execution module 303 is configured to determine whether there is a database index that matches a query condition corresponding to the target data operation request, in a case where the data operation type includes the data query type.

[0149] In a case where it is determined that there is a database index that matches the query condition, the database index is used to obtain a plurality of target data that matches the target data operation request from the database; or

[0150] In a case where it is determined that there is no database index that matches the query condition, the plurality of target data that matches the target data operation request is obtained from the database according to the query condition.

[0151] In a possible implementation, the apparatus further includes:

[0152] The first creation module 304 is configured to create and store a target index for the target data, in a case where it is determined that there is no database index that matches the query condition.

[0153] In a possible implementation, the first creation module 304 is configured to obtain a preset index creation condition, wherein the index creation condition is used to indicate a time when an index is allowed to be created, and the target index is created according to the query condition, in a case where the time indicated by the index creation condition is reached.

[0154] In a possible implementation, the database includes a plurality of data tables, and the apparatus further includes:

[0155] The second creating module 305 is configured to, after determining the data operation result corresponding to the target data operation request, create a query view in the case that the data operation result comprises target data queried from a plurality of data tables, and store a plurality of target data corresponding to the data operation result in the query view in association.

[0156] In a possible implementation, the determining module 301 is further configured to determine the waiting time threshold corresponding to the database according to the following steps:

[0157] determining, by using a preset artificial intelligence (AI) data module, a target time period in which the initiation time of the data operation request is located, from a plurality of preset time periods;

[0158] taking a preset time threshold corresponding to the target time period as the waiting time threshold corresponding to the database.

[0159] In a possible implementation, the determining module 301 is further configured to determine whether the new data operation request exists according to the following steps:

[0160] determining, by using a preset AI data module, a request receiving frequency of the data operation type in the target time period based on the target time period corresponding to the initiation time of the data operation request, the data operation type corresponding to the data operation request, and a predetermined frequency mapping relationship; the frequency mapping relationship is determined by the AI data module based on historical operation requests for the database collected in a plurality of preset time periods, and the frequency mapping relationship is used to represent the request receiving frequency of each data operation type in each preset time period;

[0161] determining whether the new data operation request exists according to the determined request receiving frequency corresponding to the target time period.

[0162] The description of the processing procedure of each module in the apparatus and the interaction procedure between the modules can refer to the related description in the above method embodiments, and will not be described in detail here.

[0163] The present disclosure also provides a computer device, as shown in Figure 4 The computer device provided by the present disclosure includes the following modules:

[0164] The processor 41 and the memory 42; the memory 42 stores machine readable instructions executable by the processor 41, and the processor 41 is configured to execute the machine readable instructions stored in the memory 42, and when the machine readable instructions are executed by the processor 41, the processor 41 performs the following steps: S101: in response to receiving a data operation request for a database, if it is determined that there is a new data operation request with the same data operation type as the data operation request within the waiting time threshold corresponding to the database, waiting to receive the new data operation request; S102: in the case where it is determined that the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold, merging the plurality of data operation requests that have been received and not processed into a target data operation request, and S103: performing a data operation corresponding to the target data operation request to obtain a data operation result; wherein the data operation result includes data operation results for the plurality of data operation requests before merging.

[0165] The memory 42 includes the memory 421 and the external memory 422; the memory 421 is also called the internal memory, and is used to temporarily store operation data in the processor 41 and exchange data with the external memory 422 such as a hard disk, and the processor 41 exchanges data with the external memory 422 through the memory 421.

[0166] The disclosure also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the data operation method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer readable storage medium.

[0167] The computer program product of the data operation method provided by the embodiments of the disclosure includes a computer readable storage medium storing program codes, and the instructions included in the program codes can be used to execute the steps of the data operation method described in the above method embodiments, which can be referred to the above method embodiments and will not be described here.

[0168] The computer program product can be specifically implemented by hardware, software or a combination thereof. In one optional embodiment, the computer program product is specifically embodied as a computer storage medium, and in another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.

[0169] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the apparatus described above can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here. In several embodiments provided in the present disclosure, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are only schematic. For example, the division of the units is only a logical function division, and another division can be made in actual implementation. For example, a plurality of units or components can be combined, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, and can be electrical, mechanical or other forms.

[0170] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0171] In addition, the functional units in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0172] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part of the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present disclosure. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0173] Finally, it should be noted that the above-described embodiments are merely specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and are not intended to limit the present disclosure. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can make modifications or easy changes to the technical solutions described in the foregoing embodiments, or easily think of changes or equivalent replacements for some of the technical features; and these modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A data manipulation method, characterized in that, include: In response to receiving a data operation request for a database, if it is determined that within the waiting time threshold corresponding to the database, there exists a new data operation request with the same data operation type as the data operation request, then wait to receive the new data operation request; wherein, the data operation type includes a data query type; If the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold, the multiple currently received and unprocessed data operation requests are automatically merged into a target data operation request. The waiting time thresholds for data operation requests of different data operation types are different. If the data operation type includes a data query type, determine whether there exists a database index that matches the query conditions corresponding to the target data operation request; If it is determined that a database index matching the query conditions exists, the database index is used to retrieve multiple target data that match the target data operation request from the database. Perform the data operation corresponding to the target data operation request to obtain the data operation result; wherein, the data operation result includes the data operation result for the multiple data operation requests before merging; If the data operation result includes target data queried from multiple data tables, a query view is created, and the multiple target data corresponding to the data operation result are stored together in the query view.

2. The method according to claim 1, characterized in that, The execution of the data operation corresponding to the target data operation request, and the obtaining of the data operation result, includes: If it is determined that no database index matches the query conditions, multiple target data that match the target data operation request are retrieved from the database according to the query conditions.

3. The method according to claim 2, characterized in that, The method further includes: If it is determined that no database index exists that matches the query criteria, a target index is created and stored for the target data.

4. The method according to claim 3, characterized in that, Creating a target index for the target data includes: Obtain preset index creation conditions; the index creation conditions are used to indicate the time when index creation is allowed, and when the time indicated by the index creation conditions is reached, create the target index according to the query conditions.

5. The method according to claim 1, characterized in that, The method further includes the step of determining the waiting time threshold corresponding to the database: Using a preset artificial intelligence (AI) data module, the target time period in which the data operation request is initiated is determined from multiple preset time periods; The preset time threshold corresponding to the target time period is used as the waiting time threshold corresponding to the database.

6. The method according to claim 1, characterized in that, The method further includes the step of determining whether the new data operation request exists: Using a preset AI data module, based on the target time period corresponding to the initiation time of the data operation request, the data operation type corresponding to the data operation request, and a pre-determined frequency mapping relationship, the request receiving frequency of the data operation type in the target time period is determined; the frequency mapping relationship is determined by the AI ​​data module based on historical operation requests collected in multiple preset time periods for the database, and the frequency mapping relationship is used to characterize the request receiving frequency of each preset time period for each data operation type. Based on the request reception frequency corresponding to the determined target time period, it is determined whether there is a new data operation request.

7. A data manipulation device, characterized in that, include: The determination module is configured to, in response to receiving a data operation request for a database, if it is determined that within the waiting time threshold corresponding to the database, there exists a new data operation request with the same data operation type as the data operation request, then wait to receive the new data operation request; wherein, the data operation type includes a data query type; The execution module is used to determine whether a database index exists that matches the query conditions corresponding to the target data operation request, when the data operation type includes a data query type. The execution module is further configured to, if it is determined that a database index matching the query conditions exists, use the database index to retrieve multiple target data matching the target data operation request from the database; The merging module is used to automatically merge multiple currently received and unprocessed data operation requests into a target data operation request when the waiting time reaches the waiting time threshold or the number of received data operation requests reaches a preset threshold. The waiting time thresholds for data operation requests of different data operation types are different. The execution module is further configured to perform data operations corresponding to the target data operation request to obtain data operation results; wherein, the data operation results include data operation results for the multiple data operation requests before merging; The second creation module is used to create a query view when the data operation result includes target data queried from multiple data tables, and to store the multiple target data corresponding to the data operation result in the query view.

8. A computer device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the data manipulation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer device, performs the steps of the data manipulation method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Processing method and distributed processing system for structured data

    CN108572970A

  • Service processing method and device

    CN113742389A