Data query method and device, storage medium and electronic equipment
By determining the start and end times of data links in a distributed system and retrieving target data links from the database based on the minimum span, the problem of low efficiency and accuracy in data retrieval in the link structure tree is solved, achieving efficient and accurate data retrieval.
Patent Information
- Application Number
- CN202310673492.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-06-07
AI Technical Summary
In existing technologies, distributed link tracing technology has low efficiency and accuracy in retrieving data in the link structure tree, and cannot effectively retrieve complex links, resulting in low efficiency, slow response speed, and low accuracy.
By determining the start and end times of the data link to be queried, index records are retrieved from the database. The target data link is determined from the initial data link based on the minimum span. Link data in the target data link is extracted, including tiered expansion supplementary queries to ensure that the number and span of data links meet user requirements.
It improves the efficiency and accuracy of data retrieval in the link structure tree, ensuring fast and accurate retrieval of complex link data in distributed systems.
Smart Images

Figure CN116775716B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of cloud computing, and in particular, to a data query method and device, a storage medium and an electronic device. BACKGROUND
[0002] In related technologies, the distributed link tracking technology is used to search for the required data link in the application scenarios of rapid fault positioning, link visualization and link analysis. However, the premise of applying the distributed link tracking technology to the above application scenarios is to search for the data link that meets the business scenario. However, the link search function in related technologies is relatively single, and only the attribute of span can be used to search for the data link that meets the condition, and there is a lack of effective algorithm to search for complex links. The link search function in related technologies cannot search for complex links in a massive link structure tree, which is low in efficiency, slow in response speed and low in accuracy.
[0003] At present, there is no effective solution to the problem of low efficiency and accuracy of searching data in a link structure tree in related technologies. SUMMARY
[0004] The main purpose of the present application is to provide a data query method and device, a storage medium and an electronic device to solve the problem of low efficiency and accuracy of searching data in a link structure tree in related technologies.
[0005] In order to achieve the above purpose, according to one aspect of the present application, a data query method is provided. The method comprises: determining the start time and end time of the data link to be queried, determining at least one index record from the database based on the start time and end time, obtaining an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtaining the query condition input by the user, extracting the data link that meets the query condition from the index record list to obtain the initial data link, wherein the query condition contains attribute information of the link data in the data link to be queried; determining the minimum span number of the data link to be queried, determining the target data link from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and the link between two adjacent nodes in the data link constitutes a span; extracting the link data in the target data link to obtain the target data queried by the user.
[0006] Optionally, determining the target data link from the initial data link based on the minimum span number comprises: determining whether the span number of the initial data link is greater than or equal to the minimum span number; and in the case where the span number of the initial data link is greater than or equal to the minimum span number, determining the initial data link as the target data link.
[0007] Optionally, after determining the target data link based on the minimum span number from the initial data link, the method further comprises: obtaining a minimum data link number required by the user to query, and determining whether the first number is greater than or equal to the minimum data link number, wherein the first number is the number of the target data link; in the case that the first number is greater than or equal to the minimum data link number, performing the step of extracting link data in the target data link to obtain the target data queried by the user; in the case that the first number of the target data link is less than the minimum data link number, screening other target data links from the pending data link based on the minimum data link number and the minimum span number, wherein the pending data link is a data link with a span number less than the minimum span number in the initial data link; combining the target data link and the other target data link to obtain an updated target data link; and performing the step of extracting link data in the target data link to obtain the target data queried by the user based on the updated target data link.
[0008] Optionally, screening the other target data link from the pending data link based on the minimum data link number and the minimum span number comprises: determining a span number interval to which the minimum span number belongs, determining an inflation coefficient of the minimum span number based on the span number interval; calculating the product of the minimum data link number, the minimum span number and the inflation coefficient to obtain a query number; arranging all the pending data links in descending order of span number to obtain a target sequence; extracting the first N data links from the target sequence, wherein N is the query number; and determining the data link with a span number greater than or equal to the minimum span number in the first N data links as the other target data link.
[0009] Optionally, after combining the target data link and the other target data link to obtain the updated target data link, the method further comprises: determining whether the second number is greater than or equal to the minimum data link number, wherein the second number is the number of the updated target data link; in the case that the second number is greater than or equal to the minimum data link number, performing the step of extracting link data in the target data link to obtain the target data queried by the user; in the case that the second number is less than the minimum data link number, issuing a first prompt information, wherein the first prompt information is used to prompt the user to re-determine the start time and the end time of the data link to be queried.
[0010] Optionally, extracting link data in the target data link to obtain the target data queried by the user comprises: determining the number of the target data link, and extracting the target data from the database based on the index record list and the number.
[0011] Optionally, after the start time and the end time of the data link to be queried are determined, the method further comprises: judging whether there is an index record between the start time and the end time in the database; in the case that there is an index record between the start time and the end time in the database, performing the step of determining at least one index record from the database storing link data based on the start time and the end time; in the case that there is no index record between the start time and the end time in the database, issuing a second prompt information, wherein the second prompt information is used to prompt the user that the data query fails.
[0012] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a data query device is provided. The device comprises: a first determining unit, configured to determine a start time and an end time of a data link to be queried, determine at least one index record from a database based on the start time and the end time, and obtain an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; a first obtaining unit, configured to obtain a query condition input by a user, extract a data link meeting the query condition from the index record list, and obtain an initial data link, wherein the query condition contains attribute information of link data in the data link to be queried; a second determining unit, configured to determine a minimum span number of the data link to be queried, and determine a target data link from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; and an extracting unit, configured to extract link data in the target data link, and obtain target data queried by the user.
[0013] According to the application, the following steps are adopted: determining a start time and an end time of a data link to be queried, determining at least one index record from a database based on the start time and the end time to obtain a list of index records to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtaining a query condition input by a user, extracting data links meeting the query condition from the list of index records to obtain initial data links, wherein the query condition contains attribute information of link data in the data link to be queried; determining a minimum span number of the data link to be queried, determining a target data link from the initial data links based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; and extracting link data in the target data link to obtain target data queried by the user, thereby solving the problem of low efficiency and accuracy of data retrieval in a link structure tree in the related art. The target data link is retrieved from the index records based on the minimum span number, and the target data queried by the user is extracted from the target data link, thereby achieving the effect of improving the efficiency and accuracy of data retrieval in the link structure tree. BRIEF DESCRIPTION OF DRAWINGS
[0014] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and are used to interpret the application together with the description of the illustrative embodiments of the present application, and do not constitute improper limitations to the present application. In the drawings:
[0015] Figure 1 is a flowchart of a data query method provided according to an embodiment of the present application;
[0016] Figure 2 is a flowchart of an optional data query method provided according to an embodiment of the present application;
[0017] Figure 3 is a schematic diagram of a data query device provided according to an embodiment of the present application;
[0018] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0019] It should be noted that the embodiments and features in the present application can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0020] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.
[0021] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0022] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties.
[0023] For the convenience of description, the following describes some nouns or terms related to the embodiments of the present application:
[0024] Distributed link tracking: Distributed link tracking is to restore a distributed call request to a call link after calling a service once in a distributed system, and to centrally display the call situation of a distributed request, such as the time consumption of each service node, the specific machine where the request arrives, the request state of each service node, etc.
[0025] Span: is the basic working unit of distributed link tracking technology, a span is created for a link call, and the span includes description information, timestamp, parent-id, etc., where the parent-id can indicate the source of the span call link. In a popular understanding, a span is a request information.
[0026] Data link: a span set similar to a tree structure, indicating a data call link corresponding to calling a service once in a distributed system, and each data link has a unique identifier.
[0027] The present application will be described below in conjunction with the preferred implementation steps, Figure 1A flowchart of a data query method according to an embodiment of the present application is shown in FIG. 1, which includes the following steps: Figure 1
[0028] In step S101, the start time and the end time of the data link to be queried are determined, at least one index record is determined from the database based on the start time and the end time, and a list of index records to be queried is obtained, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order.
[0029] Specifically, the data link to be queried can be a data link of a calling process of a user calling an A service from a distributed system of a financial institution, and the link data is stored in the index record in chronological order. For example, the index record from 0 o'clock to 1 o'clock on xx, xx, xx stores multiple data links of the calling process of the user calling the A service, the B service, and the C service, etc. The index record from 1 o'clock to 2 o'clock stores multiple data links of the calling process of the user calling the C service and the D service, etc. Each index record can store multiple data links, and a data link can also be stored in multiple index records. When the user needs to query the target data, the index range can be locked based on the start time and the end time. For example, the user inputs the start time as 1 o'clock and the end time as 2 o'clock. The list of index records to be queried includes the c data link corresponding to the calling of the C service and the d data link corresponding to the calling of the D service.
[0030] In step S102, the query condition input by the user is obtained, and the data link meeting the query condition is extracted from the list of index records to obtain the initial data link, wherein the query condition includes attribute information of the link data in the data link to be queried.
[0031] Specifically, after obtaining the list of index records to be queried, the initial data link is obtained by preliminarily screening the result through the query condition input by the user. The query condition can be a span attribute, such as a cluster name, a monitoring object, a minimum span time, etc. For example, the cluster name xx of node m in the c data link is the cluster name in the query condition, and the initial data link is the c data link.
[0032] In step S103, the minimum span number of the data link to be queried is determined, and the target data link is determined from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and the link between two adjacent nodes in the data link constitutes a span.
[0033] Specifically, there are different numbers of nodes for each data link, for example, calling a C service requires calling n nodes through m nodes in a distributed system, and the n nodes call s nodes, and the c data link is m-n-s, including two spans of m-n and n-s, and the target data link is determined by twice screening from the initial data link through the minimum span number input by the user, for example, if the minimum span number is 2, the c data link can be determined as the target data link, and if the minimum span number is 3, the c data link cannot be searched and cannot be used as the target data link.
[0034] In step S104, link data in the target data link is extracted to obtain the target data queried by the user.
[0035] Specifically, after the target data link is determined, the link data is extracted in the distributed system through the number (that is, TraceId) of the target data link to obtain the target data.
[0036] The data query method provided in the embodiments of the present application determines the start time and the end time of the data link to be queried, determines at least one index record from the database based on the start time and the end time, and obtains an index record list of the data link to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtains a query condition input by a user, extracts a data link meeting the query condition from the index record list, and obtains an initial data link, wherein the query condition contains attribute information of link data in the data link to be queried; determines a minimum span number of the data link to be queried, determines a target data link from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; and extracts link data in the target data link to obtain target data queried by the user, thereby solving the problem of low efficiency and accuracy of data retrieval in the link structure tree in related technologies. The target data link is retrieved from the index record based on the minimum span number, and the target data queried by the user is extracted from the target data link, thereby achieving the effect of improving the efficiency and accuracy of data retrieval in the link structure tree.
[0037] The target data link can be retrieved by the minimum span number. Alternatively, in the data query method provided in the embodiments of the present application, determining the target data link from the initial data link based on the minimum span number includes: judging whether the span number of the initial data link is greater than or equal to the minimum span number; and in the case that the span number of the initial data link is greater than or equal to the minimum span number, determining the initial data link as the target data link.
[0038] For example, the initial data links include a c data link, a d data link, an e data link and an f data link. The span number of the c data link is 3, the span number of the d data link is 5, the span number of the e data link is 1, the span number of the f data link is 8, and the minimum span number input by the user is 5. Then, the target data links selected from the initial data links are the d data link and the f data link. The minimum span number is used for the user to efficiently search data.
[0039] The number of the target data links searched by only the minimum span number may not meet the minimum data link number required by the user to query. Alternatively, in the data query method provided in the embodiments of the present application, after the target data links are determined from the initial data links based on the minimum span number, the method further includes: obtaining the minimum data link number required by the user to query, and determining whether the first number is greater than or equal to the minimum data link number, wherein the first number is the number of the target data links; in the case that the first number is greater than or equal to the minimum data link number, performing the step of extracting link data in the target data link to obtain the target data queried by the user; in the case that the first number of the target data links is less than the minimum data link number, selecting other target data links from the pending data links based on the minimum data link number and the minimum span number, wherein the pending data links are data links with a span number less than the minimum span number in the initial data links; combining the target data links and the other target data links to obtain updated target data links; and performing the step of extracting link data in the target data link to obtain the target data queried by the user based on the updated target data links.
[0040] Specifically, considering the engine performance of retrieving data in a distributed system, the user inputs the minimum data link number that needs to be queried, that is, the minimum data link number that the user hopes to query. The first number of target data links retrieved based on the minimum span number can be directly returned to the user as long as it meets the user's minimum data link number, so as to execute the step of extracting link data in the target data link to obtain the target data queried by the user. If the first number of target data links retrieved based on the minimum span number does not meet the user's minimum data link number. A hierarchical inflation supplementary query can be performed based on the minimum data link number and the minimum span number to obtain a sufficient number of target data links, that is, in addition to the target data links retrieved based on the minimum span number, other target data links are filtered from the pending data links based on the minimum data link number and the minimum span number. The other target data links and the target data links are combined to form updated target data links, and the step of extracting link data in the target data link to obtain the target data queried by the user is performed based on the updated target data links. By filtering other target data links from the pending data links based on the minimum data link number and the minimum span number, the number of data links queried by the user is ensured to meet the user's needs.
[0041] It should be noted that after the initial data links are filtered from the index record list based on the query condition provided by the user, the span data of the retrieved initial data links is incomplete. For example, a data link is a data link of cluster A-cluster B-cluster C, the user inputs the query condition as cluster A, and the span number of the initial data link containing the query condition cluster A returned is 1, not the complete span number 2. If the user inputs the minimum span number as 2, the data link cannot be returned to the user as the initial data link. The hierarchical inflation supplementary query is first determined based on the minimum data link number and the minimum span number from the initial data link to filter a sufficient number of data links required by the user for querying from the initial data link, and then based on the minimum span number to filter the target data link. The span number of the data link of cluster A-cluster B-cluster C obtained by the hierarchical inflation supplementary query is 2. In order to balance the query performance and be able to query the target data, hierarchical inflation supplementary query is needed. That is, other target data links are filtered from the pending data links based on the minimum data link number and the minimum span number.
[0042] Optionally, in the data query method provided in the embodiments of the present application, the other target data link is filtered out from the pending data link based on the minimum data link number and the minimum span number, comprising: determining a span number interval to which the minimum span number belongs, and determining an inflation coefficient of the minimum span number based on the span number interval; calculating the product of the minimum data link number, the minimum span number and the inflation coefficient to obtain a query number; arranging all the pending data links in descending order of span number to obtain a target sequence; extracting the first N data links from the target sequence, wherein N is the query number; and determining the data link with a span number greater than or equal to the minimum span number in the first N data links as the other target data link.
[0043] Specifically, the inflation coefficient of the minimum span number is determined based on the span number interval. For example, if the minimum span number is between 1 and 3, the inflation coefficient is 1, and the query number N = minimum data link number * 1 * minimum span number. If the minimum span number is between 4 and 10, the inflation coefficient is 2, and the query number N = minimum data link number * 2 * minimum span number. If the minimum span number is greater than 10, the inflation coefficient is 3, and the query number N = minimum data link number * 3 * minimum span number. The pending data links are arranged in descending order of span number to obtain a target sequence. The numbers of the first N data links in the target sequence are taken, and the span numbers of the first N data links are retrieved based on the numbers. For the data link with a span number greater than or equal to the minimum span number, its number is returned to the user. By filtering out the other target data link from the pending data link based on the minimum data link number and the minimum span number, the user is prevented from missing the data link meeting the query condition when determining the target data link based on the minimum span number directly.
[0044] After the pending data link is subjected to hierarchical inflation supplementary query, the number of updated target data links may also not meet the minimum data link number. Optionally, in the data query method provided in the embodiments of the present application, after the target data link and the other target data link are combined to obtain the updated target data link, the method further comprises: determining whether the second number is greater than or equal to the minimum data link number, wherein the second number is the number of the updated target data link; in the case where the second number is greater than or equal to the minimum data link number, performing the step of extracting the link data in the target data link to obtain the target data queried by the user; and in the case where the second number is less than the minimum data link number, issuing a first prompt information, wherein the first prompt information is used to prompt the user to re-determine the start time and the end time of the data link to be queried.
[0045] Specifically, after determining the other target data link from the pending data link, it is judged whether the second quantity of the updated target data link is greater than or equal to the minimum data link number. If the second quantity is greater than or equal to the minimum data link number, it indicates that the retrieved target data link meets the query requirement of the user, and the step of extracting the link data in the target data link to obtain the target data of the user query can be directly performed. If the second quantity is less than the minimum data link number, it indicates that the number of the updated target data link still does not meet the query requirement of the user after the hierarchical inflation supplement query, and at this time, a first prompt information can be sent to prompt the user to re-adjust the start time and the end time to determine more index records from the database, so as to retrieve more target data links.
[0046] Each data link corresponds to a unique number, and the target data is extracted from the target data link based on the number. Optionally, in the data query method provided in the embodiment of the application, the step of extracting the link data in the target data link to obtain the target data of the user query includes: determining the number of the target data link, and extracting the target data from the database based on the index record list and the number.
[0047] Specifically, when obtaining the target data, it is necessary to initiate a query to the distributed system according to the index record list to be queried and the numbers of all target data links, to obtain the detailed data of each target data link, that is, the target data.
[0048] If the index record cannot be queried based on the start time and the end time, the user is prompted that the query fails. Optionally, in the data query method provided in the embodiment of the application, after determining the start time and the end time of the data link to be queried, the method further includes: judging whether there is an index record between the start time and the end time in the database; in the case that there is an index record between the start time and the end time in the database, performing the step of determining at least one index record from the database storing the link data based on the start time and the end time; in the case that there is no index record between the start time and the end time in the database, sending a second prompt information, wherein the second prompt information is used to prompt the user that the data query fails.
[0049] Specifically, after the user inputs the start time and the end time, there can be a case that the index record cannot be retrieved in the database. Therefore, if the index record cannot be retrieved based on the start time and the end time, a second prompt information is sent to the user to prompt the user that the data query fails this time.
[0050] According to another embodiment of the application, an optional data query method is further provided, Figure 2 is a flowchart of the optional data query method provided in the embodiment of the application, like Figure 2As shown, the method comprises:
[0051] S201: Lock the index range, according to the start and end time of user input, obtain the index list to be queried.
[0052] Specifically, the link data is stored according to the time-sharing logic, and the data of each hour is stored in an index. The first step of the query needs to lock the index range through the start and end time. It is judged whether the index list is empty. If yes, the query is directly ended. If the index list is not empty, the step S2 is executed.
[0053] S202: Preliminary screening of the obtained results, according to the query index list, the span attribute input by the user, the spanId and traceId returned by the query. According to the minimum number of span input by the user, the traceId is screened.
[0054] Specifically, the preliminary results are obtained from the index list to be queried. The span attribute input by the user can be cluster name, monitoring object, and minimum time-consuming span. Based on the minimum number of span input by the user, the traceId and the number of spans of each trace are screened.
[0055] S203: Hierarchical expansion and supplementary query, according to the minimum number of span, hierarchical expansion, and query returns the traceId meeting the conditions.
[0056] Specifically, if the number of query returned by S2 does not meet the user's requirement, step S3 is continued. After the span attribute provided by the user is filtered, the returned span data is incomplete. For example, a link of cluster A->cluster B->cluster C, the user inputs the condition of cluster A, and only returns the span number of the trace as 1. If the user inputs the minimum number of span as 2, the trace cannot be returned to the user. Therefore, supplementary query is needed. In order to balance the query performance and query data, the minimum number of span input by the user is hierarchically expanded.
[0057] S204: Obtain detailed data, according to the index list to be queried and the traceId list, initiate query, and obtain link details.
[0058] According to the data query method provided by the embodiment of the application, the complex trace data meeting the conditions is retrieved according to the preset minimum number of span. While ensuring the stability of the system performance, the user can quickly retrieve the complex link data.
[0059] It is noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0060] The embodiment of the present application further provides a data query device. It is noted that the data query device of the embodiment of the present application can be used to execute the data query method provided by the embodiment of the present application. The data query device provided by the embodiment of the present application is introduced as follows.
[0061] Figure 3 FIG. 1 is a schematic diagram of a data query device according to the embodiment of the present application. As shown in the figure, the device comprises: Figure 3
[0062] The first determining unit 10 is configured to determine a start time and an end time of a data link to be queried, determine at least one index record from a database based on the start time and the end time, and obtain an index record list of the data link to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order;
[0063] The first obtaining unit 20 is configured to obtain a query condition input by a user, extract a data link meeting the query condition from the index record list, and obtain an initial data link, wherein the query condition contains attribute information of link data in the data link to be queried;
[0064] The second determining unit 30 is configured to determine a minimum span number of the data link to be queried, and determine a target data link from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span;
[0065] The extracting unit 40 is configured to extract link data in the target data link, and obtain a target data queried by the user.
[0066] The data query device provided in the embodiments of the present application determines the start time and the end time of the data link to be queried through the first determination unit 10, determines at least one index record from the database based on the start time and the end time, and obtains an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; the first acquisition unit 20 acquires the query condition input by the user, extracts the data link meeting the query condition from the index record list, and obtains the initial data link, wherein the query condition includes attribute information of the link data in the data link to be queried; the second determination unit 30 determines the minimum span number of the data link to be queried, and determines the target data link from the initial data link based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and the link between two adjacent nodes in the data link constitutes a span; and the extraction unit 40 extracts the link data in the target data link, and obtains the target data queried by the user, thereby solving the problem of low efficiency and accuracy of data retrieval in the link structure tree in the related art, retrieving the target data link from the index record based on the minimum span number, extracting the target data queried by the user from the target data link, and further achieving the effect of improving the efficiency and accuracy of data retrieval in the link structure tree.
[0067] Optionally, in the data query device provided in the embodiments of the present application, the second determination unit 30 includes: a judgment module, configured to judge whether the span number of the initial data link is greater than or equal to the minimum span number; and a first determination module, configured to determine the initial data link as the target data link in the case that the span number of the initial data link is greater than or equal to the minimum span number.
[0068] Optionally, in the data query device provided in the embodiments of the present application, the device further includes: a second acquisition unit, configured to acquire the minimum data link number required by the user to query, and judge whether the first number is greater than or equal to the minimum data link number, wherein the first number is the number of the target data link; a first execution unit, configured to execute the step of extracting the link data in the target data link to obtain the target data queried by the user in the case that the first number is greater than or equal to the minimum data link number; a screening unit, configured to screen other target data links from the pending data link based on the minimum data link number and the minimum span number in the case that the first number of the target data link is less than the minimum data link number, wherein the pending data link is a data link whose span number is less than the minimum span number; a combination unit, configured to combine the target data link and the other target data link to obtain an updated target data link; and a second execution unit, configured to execute the step of extracting the link data in the target data link to obtain the target data queried by the user based on the updated target data link.
[0069] Optionally, in the data query device provided by the embodiment of the present application, the screening unit comprises: a second determination module, configured to determine a span number interval to which the minimum span number belongs, and determine an inflation coefficient of the minimum span number based on the span number interval; a first calculation module, configured to calculate a product of the minimum data link number, the minimum span number and the inflation coefficient to obtain a query number; an arrangement module, configured to arrange all the pending data links in a descending order of span number to obtain a target sequence; an extraction module, configured to extract the first N data links from the target sequence, wherein N is the query number; and a third determination module, configured to determine the data links with a span number greater than or equal to the minimum span number in the first N data links as the other target data links.
[0070] Optionally, in the data query device provided by the embodiment of the present application, the device further comprises: a first judgment unit, configured to judge whether the second number is greater than or equal to the minimum data link number, wherein the second number is the number of the updated target data links; a third execution unit, configured to execute the step of extracting the link data in the target data links to obtain the target data of the user query in the case that the second number is greater than or equal to the minimum data link number; and a first prompt unit, configured to issue a first prompt information in the case that the second number is less than the minimum data link number, wherein the first prompt information is used to prompt the user to re-determine the start time and the end time of the data link to be queried.
[0071] Optionally, in the data query device provided by the embodiment of the present application, the extraction unit 40 comprises: a fourth determination module, configured to determine the number of the target data links, and extract the target data from the database based on the index record list and the number.
[0072] Optionally, in the data query device provided by the embodiment of the present application, the device further comprises: a second judgment unit, configured to judge whether there is an index record between the start time and the end time in the database; a fourth execution unit, configured to execute the step of determining at least one index record from the database storing the link data based on the start time and the end time in the case that there is an index record between the start time and the end time in the database; and a second prompt unit, configured to issue a second prompt information in the case that there is no index record between the start time and the end time in the database, wherein the second prompt information is used to prompt the user that the data query fails.
[0073] The data query device comprises a processor and a memory, and the above-mentioned first determination unit 10, the first acquisition unit 20, the second determination unit 30 and the extraction unit 40 are all stored in the memory as program units, and the corresponding functions are realized by the processor executing the above-mentioned program units stored in the memory.
[0074] The processor comprises a core, and the core retrieves corresponding program units in the memory.
[0075] The memory can comprise non-permanent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM), and the memory comprises at least one memory chip.
[0076] The embodiment of the present application provides a computer readable storage medium, which stores a program, and the program is executed by a processor to implement the data query method.
[0077] The embodiment of the present application provides a processor, which is used for running a program, and the program is executed to implement the data query method.
[0078] Figure 4 is a schematic diagram of an electronic device according to the embodiment of the present application. Figure 4 As shown in the figure, the electronic device 401 comprises a processor, a memory and a program stored in the memory and capable of running on the processor, and the processor implements the following steps when executing the program: determining a start time and an end time of a data link to be queried, determining at least one index record from a database based on the start time and the end time to obtain an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtaining a query condition input by a user, extracting data links meeting the query condition from the index record list to obtain initial data links, wherein the query condition comprises attribute information of link data in the data link to be queried; determining a minimum span number of the data link to be queried, determining a target data link from the initial data links based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; and extracting link data in the target data link to obtain target data queried by the user. The device in the present application can be a server, a PC, a PAD, a mobile phone or the like.
[0079] The application further provides a computer program product, which is suitable for executing the program of the following method steps when executed on a data processing device: determining a start time and an end time of a data link to be queried, determining at least one index record from a database based on the start time and the end time, obtaining a list of index records to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtaining a query condition input by a user, extracting data links meeting the query condition from the list of index records to obtain initial data links, wherein the query condition contains attribute information of link data in the data link to be queried; determining a minimum span number of the data link to be queried, determining a target data link from the initial data links based on the minimum span number, wherein the minimum span number is a minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; and extracting link data in the target data link to obtain a target data queried by the user.
[0080] Those skilled in the art will understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0081] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0082] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0083] These computer program instructions can also be loaded into computer or other programmable data processing devices to cause a series of operational steps to be performed on the computer or other programmable devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable devices provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 Figure 1
[0084] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0085] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the processor can execute instructions. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other memory technologies, CD-ROM, digital versatile disc (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information for access by a computing device. In no case does the medium include a transitory signal.
[0086] Computer readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for storage of information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically programmable read only memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.
[0087] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to encompass a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article or apparatus that includes the element.
[0088] Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer-readable program code thereon for use by or in connection with an instruction execution system. For the purposes of this description, a computer-usable or computer readable storage medium can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The medium can be electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. The computer-usable or computer readable program code can be downloaded from an Internet website, server, or other remote source via a network or a data stream communication path. From the Internet website, server, or other remote source, the code can be downloaded into the instruction execution system, apparatus, or device where execution of the same can take place. The present application is directed to any number and type of computer-usable storage media, apparatuses, and devices self-evidently known to one of ordinary skill in the art.
[0089] The foregoing is merely illustrative of the principles of the application, and various modifications can be made by those skilled in the art without departing from the scope of the application. The depicted embodiments are to be considered in all respects only as illustrative, and not restrictive.
Claims
1. A data query method, characterized by, The method comprises the following steps: determining the start time and the end time of the data link to be queried, determining at least one index record from a database based on the start time and the end time, and obtaining an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in chronological order; obtaining a query condition input by a user, extracting data links meeting the query condition from the index record list, and obtaining initial data links, wherein the query condition contains attribute information of link data in the data link to be queried; determining the minimum span number of the data link to be queried, determining a target data link from the initial data links based on the minimum span number, wherein the minimum span number is the minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes a span; extracting link data in the target data link to obtain target data queried by the user; after determining the target data link from the initial data links based on the minimum span number, the method further comprises the following steps: obtaining the minimum data link number required by the user to query, and determining whether a first number is greater than or equal to the minimum data link number, wherein the first number is the number of the target data link; in the case that the first number is greater than or equal to the minimum data link number, performing the step of extracting link data in the target data link to obtain target data queried by the user; in the case that the first number of the target data link is less than the minimum data link number, screening other target data links from the pending data links based on the minimum data link number and the minimum span number, wherein the pending data link is a data link whose span number is less than the minimum span number in the initial data link; combining the target data link and the other target data link to obtain an updated target data link; performing the step of extracting link data in the target data link to obtain target data queried by the user based on the updated target data link.
2. The method of claim 1, wherein, determining the target data link from the initial data links based on the minimum span number comprises the following steps: determining whether the span number of the initial data link is greater than or equal to the minimum span number; in the case that the span number of the initial data link is greater than or equal to the minimum span number, determining the initial data link as the target data link.
3. The method of claim 1, wherein, screening the other target data links from the pending data links based on the minimum data link number and the minimum span number comprises the following steps: determining a span number interval to which the minimum span number belongs, determining an inflation coefficient of the minimum span number based on the span number interval; calculating the product of the minimum data link number, the minimum span number and the inflation coefficient to obtain a query number; arranging all the pending data links in descending order of span number to obtain a target sequence; extracting the first N data links from the target sequence, wherein N is the query number. The first determination unit is configured to determine a start time and an end time of the data link to be queried, determine at least one index record from a database based on the start time and the end time, and obtain an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in a time sequence.
4. The method of claim 1, wherein, After the target data link and the other target data link are combined to obtain an updated target data link, the method further comprises: determining whether a second quantity is greater than or equal to the minimum data link quantity, wherein the second quantity is a quantity of the updated target data link; in a case where the second quantity is greater than or equal to the minimum data link quantity, performing the step of extracting link data in the target data link to obtain target data of the user query; in a case where the second quantity is less than the minimum data link quantity, issuing a first prompt information, wherein the first prompt information is used to prompt the user to re-determine the start time and the end time of the data link to be queried.
5. The method of claim 1, wherein, extracting link data in the target data link to obtain target data of the user query comprises: determining a number of the target data link, and extracting the target data from the database based on the index record list and the number.
6. The method of claim 1, wherein, After the start time and the end time of the data link to be queried are determined, the method further comprises: determining whether there is an index record between the start time and the end time in the database; in a case where there is the index record between the start time and the end time in the database, performing the step of determining at least one index record from a database storing link data based on the start time and the end time; in a case where there is no index record between the start time and the end time in the database, issuing a second prompt information, wherein the second prompt information is used to prompt the user that the data query fails.
7. A data query apparatus, characterized by comprising: comprises: a first determination unit configured to determine a start time and an end time of the data link to be queried, determine at least one index record from a database based on the start time and the end time, and obtain an index record list to be queried, wherein the database stores index records, and each index record stores link data in a preset time period in a time sequence; a first acquisition unit configured to acquire a query condition input by a user, extract a data link meeting the query condition from the index record list, and obtain an initial data link, wherein the query condition contains attribute information of link data in the data link to be queried; a second determination unit configured to determine a minimum span number of the data link to be queried, and determine a target data link from the initial data link based on the minimum span number, wherein the minimum span number is a minimum number of spans contained in the data link to be queried, and a link between two adjacent nodes in the data link constitutes one span; an extraction unit configured to extract link data in the target data link to obtain target data of the user query. The device further comprises a second acquisition unit configured to acquire a minimum data link number required by the user to query, and determine whether the first number is greater than or equal to the minimum data link number, wherein the first number is the number of target data links; a first execution unit configured to, in the case that the first number is greater than or equal to the minimum data link number, execute the step of extracting link data in the target data link to obtain target data queried by the user; a screening unit configured to, in the case that the first number of the target data link is less than the minimum data link number, screen other target data links from the pending data link based on the minimum data link number and the minimum span number, wherein the pending data link is a data link with a span number less than the minimum span number in the initial data link; a combination unit configured to combine the target data link and the other target data link to obtain an updated target data link; and a second execution unit configured to execute the step of extracting link data in the target data link based on the updated target data link to obtain target data queried by the user.
8. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored program, wherein the program controls the device in which the non-volatile storage medium is located to execute the data query method of any one of claims 1 to 6 when the program is executed.
9. An electronic device, comprising: The device comprises one or more processors and a memory, and the memory is configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the data query method of any one of claims 1 to 6.
Citation Information
Patent Citations
Distributed link tracking method, system and equipment under multiple tenants and storage medium
CN109656700A
Link tracking method and apparatus
WO2020233015A1