Data query methods, devices, computer equipment and storage media
By converting indicator data query requests into query statements and using index tables for frequency determination and pre-calculation, the problem of resource waste caused by repeated queries is solved, and efficient indicator data querying is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2022-08-19
- Publication Date
- 2026-06-30
AI Technical Summary
The existing data query behavior involves a large number of duplicate queries, resulting in wasted computing resources and low query efficiency.
After receiving a query request for indicator data, the system converts it into a query statement in a preset language, determines whether the query frequency is less than a frequency threshold, and if not, redirects the query to the index table to query the target index. If the target index exists, the system retrieves the target indicator data from the index table and performs pre-calculation and index table construction during idle business periods, using the index table to achieve fast querying.
It reduces the resource consumption of duplicate indicator queries and improves the processing efficiency of indicator data queries, especially the response speed of high-frequency queries.
Smart Images

Figure CN115292580B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, and in particular to data query methods, devices, computer equipment and storage media. Background Technology
[0002] Currently, big data services are mainly divided into three stages: data collection, data processing, and data analysis and visualization. Various business departments generate data during their operations. The big data department collects this data and processes it according to business needs and relevant business areas to meet the requirements of each department. A significant proportion of these business needs involve tracking key performance indicators (KPIs). These KPIs are often mature and established metrics within the industry, such as monthly active users (MAU), which can quickly reflect behavioral trends in business activities. Business departments analyze and visualize these KPIs to provide targeted services based on user behavior.
[0003] In existing methods of querying indicator data, different business personnel perform numerous repetitive queries and analyses on fixed indicators anytime, anywhere, based on business scenarios and needs. However, a large number of repetitive queries consume significant platform computing resources, resulting in substantial waste of computing resources and low query efficiency for indicator data. Summary of the Invention
[0004] The purpose of this application is to provide a data query method, apparatus, computer device, and storage medium to solve the technical problems of existing index data query behavior having a large number of duplicate queries, which easily leads to a large waste of computing resources and low query efficiency of index data.
[0005] To address the aforementioned technical problems, this application provides a data query method, employing the following technical solution:
[0006] Receive user-input query requests for indicator data;
[0007] The indicator data query request is converted into a query statement in a preset language;
[0008] The query frequency of the query statement is obtained based on a preset query statement searcher, and it is determined whether the query frequency is less than a preset frequency threshold.
[0009] If the frequency is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether there is a target index in the index table that matches the query statement.
[0010] If a target index matching the query statement exists, retrieve the target indicator data corresponding to the target index from the index table;
[0011] The target metric data is returned to the user's client.
[0012] Furthermore, prior to the step of redirecting the query statement to a preset index table, the method further includes:
[0013] Obtain pre-stored historical query statements corresponding to historical indicator data query requests; wherein, the number of historical query statements includes multiple statements;
[0014] Get the current time and determine whether the current time is within the business's idle period;
[0015] If so, the historical query statements are disassembled and analyzed to obtain the duplicate data present in the historical query statements;
[0016] The duplicate data is classified and organized based on a preset algorithm to obtain intermediate data.
[0017] The intermediate data is pre-calculated to obtain the corresponding indicator data;
[0018] Based on the one-to-one correspondence between the intermediate data and the indicator data, the index table is constructed using the intermediate data and the indicators.
[0019] Furthermore, before the step of obtaining the current time and determining whether the current time is within a business idle period, the method further includes:
[0020] Obtain a preset division value, and divide a day into multiple processing time periods based on the division value;
[0021] Based on a preset statistical database, the total resource consumption for each processing time period within a preset time period is obtained.
[0022] Filter out the first total resource consumption that is greater than the first preset resource threshold from all the total resource consumption, and determine the first processing time period corresponding to the first total resource consumption;
[0023] For each of the first processing time periods, obtain all resource consumption corresponding to the first specified processing time period within the preset time period; wherein, the first specified processing time period is any one of the first processing time periods;
[0024] Determine whether the consumption of each of the aforementioned resources is greater than the second preset resource threshold;
[0025] If so, mark the first specified processing time period as the second processing time period;
[0026] The second processing time period is removed from all the processing time periods to obtain the third processing time period;
[0027] The third processing time period is taken as the business idle time period.
[0028] Furthermore, after the step of constructing the index table using the intermediate data and the indicators based on the one-to-one correspondence between the intermediate data and the indicator data, the method further includes:
[0029] Obtain the occupied capacity value of the index table, and obtain the available local storage capacity;
[0030] Calculate the difference between the available storage and the occupied capacity.
[0031] Determine whether the difference is greater than a preset threshold;
[0032] If the value exceeds the preset threshold, the index table will be stored locally.
[0033] If the value is not greater than the preset threshold, the index table will be stored in the blockchain.
[0034] Furthermore, after the step of determining whether the query frequency is less than a preset frequency threshold, the method further includes:
[0035] If the frequency is less than the specified threshold, the query statement will be translated into the application language.
[0036] The application language is sent to a preset data platform so that the data platform can perform real-time calculations based on the application language to generate corresponding first indicator data;
[0037] Receive the first indicator data fed back by the data platform;
[0038] The first indicator data is returned to the user's client.
[0039] Furthermore, after the step of determining whether a target index matching the query statement exists in the index table, the method further includes:
[0040] If no target index matches the query statement, the query statement is sent to a preset computing platform so that the computing platform can perform real-time calculations based on the query statement to generate corresponding second indicator data.
[0041] Receive the second indicator data fed back by the computing platform;
[0042] The second indicator data is returned to the user's client.
[0043] Furthermore, the indicator data query request carries the user's user information, and the step of converting the indicator data query request into a query statement in a preset language specifically includes:
[0044] Obtain the user information from the indicator data query request;
[0045] The user is authenticated based on the user information, and it is determined whether the authentication is successful.
[0046] If authentication is successful, the step of converting the indicator data query request into a query statement in a preset language will be executed.
[0047] To address the aforementioned technical problems, this application also provides a data query device, which employs the following technical solution:
[0048] The first receiving module is used to receive user-input query requests for indicator data;
[0049] The conversion module is used to convert the indicator data query request into a query statement in a preset language;
[0050] The first judgment module is used to obtain the query frequency of the query statement based on a preset query statement searcher, and to determine whether the query frequency is less than a preset frequency threshold.
[0051] The second judgment module is used to redirect the query statement to a preset index table if the frequency threshold is not less than the frequency threshold, and to determine whether there is a target index in the index table that matches the query statement.
[0052] The query module is used to retrieve the target indicator data corresponding to the target index from the index table if a target index matching the query statement exists.
[0053] The first return module is used to return the target indicator data to the user's client.
[0054] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0055] Receive user-input query requests for indicator data;
[0056] The indicator data query request is converted into a query statement in a preset language;
[0057] The query frequency of the query statement is obtained based on a preset query statement searcher, and it is determined whether the query frequency is less than a preset frequency threshold.
[0058] If the frequency is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether there is a target index in the index table that matches the query statement.
[0059] If a target index matching the query statement exists, retrieve the target indicator data corresponding to the target index from the index table;
[0060] The target metric data is returned to the user's client.
[0061] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0062] Receive user-input query requests for indicator data;
[0063] The indicator data query request is converted into a query statement in a preset language;
[0064] The query frequency of the query statement is obtained based on a preset query statement searcher, and it is determined whether the query frequency is less than a preset frequency threshold.
[0065] If the frequency is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether there is a target index in the index table that matches the query statement.
[0066] If a target index matching the query statement exists, retrieve the target indicator data corresponding to the target index from the index table;
[0067] The target metric data is returned to the user's client.
[0068] Compared with the prior art, the embodiments of this application have the following main advantages:
[0069] In this embodiment, upon receiving a user-inputted indicator data query request, the request is first converted into a query statement in a preset language. Then, based on a preset query statement searcher, the query frequency of the query statement is obtained, and it is determined whether the query frequency is less than a preset frequency threshold. If it is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether a target index matching the query statement exists in the index table. If a target index matching the query statement exists, the target indicator data corresponding to the target index is retrieved from the index table, and finally, the target indicator data is returned to the user's client. The indicator data query method proposed in this application, by judging the query frequency corresponding to the indicator data query request, when the query statement is identified as a high-frequency query statement, uses a preset index table to quickly retrieve the target indicator data corresponding to the query statement. This skips multiple steps in the full query process, reduces the resource consumption of repeated indicator query operations, and effectively improves the processing efficiency of indicator data queries. Attached Figure Description
[0070] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0071] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0072] Figure 2 A flowchart of an embodiment of the data query method according to this application;
[0073] Figure 3 This is a schematic diagram of the structure of one embodiment of the data query device according to this application;
[0074] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0075] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0076] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0077] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0078] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0079] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0080] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0081] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0082] It should be noted that the data query method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the data query device is generally set in the server / terminal device.
[0083] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0084] Continue to refer to Figure 2 A flowchart of an embodiment of the data query method according to this application is shown. The data query method includes the following steps:
[0085] Step S201: Receive the indicator data query request input by the user.
[0086] In this embodiment, the data query method runs on an electronic device (e.g., Figure 1 The server / terminal device shown can receive user-inputted indicator data query requests via wired or wireless connections. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future-developed wireless connection methods. Users send indicator data query requests to the electronic device through a client to obtain the required indicator data.
[0087] Step S202: Convert the indicator data query request into a query statement in a preset language.
[0088] In this embodiment, the preset language is DSL language, and the query statement is SQL statement. The process of converting the indicator data query request into a query statement in the preset language can be performed through applications related to statement conversion.
[0089] Step S203: Obtain the query frequency of the query statement based on a preset query statement searcher, and determine whether the query frequency is less than a preset frequency threshold.
[0090] In this embodiment, when the query statement searcher obtains each query statement, it records the query status of that query statement, specifically the query frequency. If the query frequency of a query statement exceeds the aforementioned frequency threshold, the corresponding indicator data is determined to be a duplicated indicator. The value of the frequency threshold is not specifically limited and can be set according to actual usage needs; for example, it can be set to 5 times per week.
[0091] Step S204: If the frequency threshold is not less than the specified frequency threshold, the query statement is redirected to a preset index table, and it is determined whether there is a target index in the index table that matches the query statement.
[0092] In this embodiment, if the query frequency of a query statement is not less than a preset frequency threshold, it indicates that the query indicator corresponding to the query statement is a high-frequency query indicator. Therefore, the indicator data corresponding to the query statement can be quickly found using a pre-built index table. This index table is generated based on processing pre-stored historical query statements corresponding to historical indicator data query requests. During off-peak business periods, i.e., when the computing resources of electronic devices are idle, the electronic devices will perform calculations and prepare corresponding indexes and indicator data in advance for business personnel's query needs during business hours, based on offline calculation requests initiated by the program, to facilitate the subsequent index table construction process. Specifically, by judging the query frequency of query statements, high-frequency and low-frequency query statements can be classified. To avoid redundant calculations caused by high-frequency query statements and the immediate computing pressure on the computing platform caused by ad-hoc calculations, a full-process offline pre-calculation is performed on high-frequency query statements during off-peak business periods, including query statement storage, parsing, intermediate data classification, and finally forming an index table of indicators. This allows business personnel to quickly query duplicate indicators using the index table.
[0093] Step S205: If a target index that matches the query statement exists, retrieve the target indicator data corresponding to the target index from the index table.
[0094] In this embodiment, if a target index matching the query statement exists in the index table, it indicates that the queried indicator corresponding to the query statement belongs to the indicator data that has already been calculated. The target indicator data corresponding to the target index can be directly queried through the index table and the target indicator data can be displayed.
[0095] Step S206: Return the target indicator data to the user's client.
[0096] Upon receiving a user's query request for indicator data, this application first converts the query request into a query statement in a preset language. Then, based on a preset query statement searcher, it obtains the query frequency of the query statement and determines whether the query frequency is less than a preset frequency threshold. If it is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether a target index matching the query statement exists in the index table. If a target index matching the query statement exists, the target indicator data corresponding to the target index is retrieved from the index table, and finally, the target indicator data is returned to the user's client. The indicator data query method proposed in this application, by judging the query frequency corresponding to the indicator data query request, when the query statement is determined to be a high-frequency query statement, uses a preset index table to quickly retrieve the target indicator data corresponding to the query statement. This skips multiple steps in the full query process, reduces the resource consumption of repeated indicator query operations, and effectively improves the processing efficiency of indicator data query.
[0097] In some alternative implementations, prior to step S204, the electronic device may also perform the following steps:
[0098] Obtain pre-stored historical query statements corresponding to historical indicator data query requests; wherein, the number of historical query statements includes multiple statements.
[0099] In this embodiment, business personnel often perform a large number of indicator query operations in their respective application systems according to different business scenarios and constantly changing business needs, thereby generating corresponding historical indicator data query requests. These historical indicator data query requests can be parsed into a unified DSL language by the application to obtain historical query statements. Historical query statements are generally SQL-like query statements, which are transmitted to electronic devices through corresponding interfaces to realize the storage of historical query statements.
[0100] Get the current time and determine whether the current time is within the business's idle period.
[0101] In this embodiment, generating the index table during the idle time period of the electronic device can effectively reduce the impact on the normal operation of the electronic device and ensure the rational use of system resources. In addition, the specific implementation process during the idle time period will be described in more detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0102] If so, the historical query statements are disassembled and analyzed to obtain the duplicate data present in the historical query statements.
[0103] In this embodiment, duplicate data refers to the parts of historical query statements that have the same query syntax and objects, including query operation operators, filtering conditions, and combinations of query sub-tables.
[0104] Intermediate data is obtained by classifying and organizing the duplicate data based on a preset algorithm.
[0105] In this embodiment, the aforementioned preset algorithm is specifically the shuffle algorithm. The shuffle algorithm, also known as the card-shuffling algorithm, aims to do the opposite of various sort algorithms, that is, to shuffle an ordered (or unordered) series of elements to meet the requirements.
[0106] The intermediate data is pre-calculated to obtain the corresponding indicator data.
[0107] In this embodiment, pre-calculation processing of intermediate data refers to pre-calculating the query operation operators, filtering conditions, and query sub-table combinations in the intermediate data to obtain the corresponding indicator data.
[0108] Based on the one-to-one correspondence between the intermediate data and the indicator data, the index table is constructed using the intermediate data and the indicators.
[0109] In this embodiment, for all the obtained intermediate data and indicator data, the intermediate data can be stored in a preset data table as an index of the corresponding indicator data, thereby generating the above-mentioned index table.
[0110] This application constructs an index table based on pre-stored historical indicator query requests. This facilitates business personnel in quickly and automatically retrieving the required indicator data from the index table when performing high-frequency, repetitive indicator queries. High-frequency indicator queries can skip multiple steps in the full query process and directly obtain the corresponding indicator data through the index table, thereby reducing the resource consumption of repetitive operations, improving resource utilization, and effectively improving the processing efficiency of indicator data queries.
[0111] In some optional implementations of this embodiment, before the step of obtaining the current time and determining whether the current time is within a business idle period, the electronic device may further perform the following steps:
[0112] Obtain a preset division value, and divide a day into multiple processing time periods based on the division value.
[0113] In this embodiment, the above division value is not specifically limited. For example, it can be set to 6 hours, that is, using 4 hours as the length of a processing period. Then, starting from 0:00, the 24 hours of a day can be divided into 6 processing periods, namely 0:00-4:00; 4:00-8:00; 8:00-12:00; 12:00-16:00; 16:00-20:00; 20:00-24:00.
[0114] Based on a preset statistical database, the total resource consumption for each processing time period within a preset time period is obtained.
[0115] In this embodiment, the aforementioned statistical database is a database storing resource consumption data of electronic devices. This resource consumption data may refer to memory consumption, CPU consumption, etc. Furthermore, the aforementioned preset time period is not specifically limited and can be set according to actual business usage needs. For example, the preset time period may be the previous week adjacent to the current time. For instance, if any processing time period is 12:00-16:00, then the total resource consumption of this data processing time period 12:00-16:00 within the previous week adjacent to the current time is the sum of the resource consumption corresponding to the time period 12:00-16:00 within that week.
[0116] From all the total resource consumption, select the first total resource consumption that is greater than the first preset resource threshold, and determine the first processing time period corresponding to the first total resource consumption.
[0117] In this embodiment, the value of the first preset resource threshold is not specifically limited and can be set according to actual needs. If the total resource consumption refers to the CPU consumption, then the first preset resource threshold can be 70%.
[0118] For each of the first processing time periods, obtain all resource consumption corresponding to the first specified processing time period within the preset time period; wherein, the first specified processing time period is any one of the first processing time periods.
[0119] Determine whether the consumption of each of the resources is greater than the second preset resource threshold.
[0120] In this embodiment, the value of the second preset resource threshold is not specifically limited and can be set according to actual needs. If the total resource consumption refers to the CPU consumption, then the first preset resource threshold can be 60%.
[0121] If so, mark the first specified processing time period as the second processing time period.
[0122] The second processing time period is removed from all the processing time periods to obtain the third processing time period.
[0123] The third processing time period is taken as the business idle time period.
[0124] This application performs statistical analysis on the resource consumption data of electronic devices within a preset time period, and intelligently determines the idle time periods of the electronic devices based on the analysis results. This effectively ensures the accuracy of the generated idle time periods, preventing subsequent index table generation from occurring during busy periods. Instead, index table generation is performed during idle time periods that avoid the busy periods, thereby effectively reducing the impact on the normal operation of electronic devices, ensuring the rational use of system resources, and improving the processing speed and efficiency of index table generation.
[0125] In some alternative implementations, after the step of constructing the index table using the intermediate data and the indicators based on the one-to-one correspondence between the intermediate data and the indicator data, the electronic device may further perform the following steps:
[0126] Obtain the occupied capacity value of the index table, and obtain the available local storage.
[0127] Calculate the difference between the available storage capacity and the occupied capacity value.
[0128] In this embodiment, the difference refers to the value obtained by subtracting the occupied capacity value from the available storage capacity.
[0129] Determine whether the difference is greater than a preset threshold.
[0130] In this embodiment, the aforementioned preset threshold is a value that indicates the electronic device can operate normally. That is, if the current available storage capacity of the electronic device is greater than the preset threshold, it means that the electronic device can operate normally. Furthermore, the value of the preset threshold is not specifically limited and can be set according to actual usage needs.
[0131] If the value exceeds the preset threshold, the index table will be stored locally.
[0132] In this embodiment, storing the index table locally can effectively avoid the problem of low data query success rate caused by network instability or disconnection, thus improving the storage adaptability of the index table.
[0133] If the value is not greater than the preset threshold, the index table will be stored in the blockchain.
[0134] In this embodiment, by using blockchain to store and manage the above-mentioned quotation data list, the security and immutability of the above-mentioned index table can be effectively guaranteed.
[0135] This application improves the intelligence and adaptability of index table storage by comparing the occupied capacity value of the index table with the available local storage, and then storing the index table locally or in the blockchain based on the comparison result, while also ensuring the data security of the index table.
[0136] In some alternative implementations, after step S203, the electronic device may further perform the following steps:
[0137] If the frequency is less than the stated frequency threshold, the query statement will be translated into the application language.
[0138] In this embodiment, the query statement is typically an SQL-like statement. If the query frequency is less than the specified frequency threshold, the query searcher will only record the query status (i.e., query frequency) of the query statement and will not perform any redirection processing related to the index table.
[0139] The application language is sent to a preset data platform so that the data platform can perform real-time calculations based on the application language to generate corresponding first indicator data.
[0140] In this embodiment, the data platform described above can be a big data platform with the ability to calculate indicator data corresponding to the application language.
[0141] Receive the first indicator data fed back by the data platform.
[0142] The first indicator data is returned to the user's client.
[0143] After obtaining the query frequency of the query statement, if it is determined that the query frequency is less than a preset frequency threshold, the application will intelligently perform real-time calculations based on the application language corresponding to the query statement on a preset data platform to generate corresponding indicator data, which effectively improves the intelligence of indicator data query processing.
[0144] In some optional implementations of this embodiment, after step S204, the electronic device may further perform the following steps:
[0145] If no target index matches the query statement, the query statement is sent to a preset computing platform so that the computing platform can perform real-time calculations based on the query statement to generate corresponding second indicator data.
[0146] In this embodiment, the query statement is a SQL-like statement, and the data platform can be a big data platform with the ability to calculate indicator data corresponding to the query statement.
[0147] Receive the second indicator data fed back by the computing platform.
[0148] The second indicator data is returned to the user's client.
[0149] After redirecting the query statement to a preset index table, if it is detected that there is no target index corresponding to the query statement in the index table, the application will intelligently perform real-time calculation on the query statement based on a preset computing platform to generate corresponding indicator data, which effectively improves the intelligence of indicator data query processing.
[0150] In some optional implementations of this embodiment, the indicator data query request carries the user's user information, and step S202 includes the following steps:
[0151] The user information is obtained from the indicator data query request.
[0152] In this embodiment, the aforementioned user information may include the user's identity information, such as the user's name or user ID, account and password information, or the user's biometric information.
[0153] The user is authenticated based on the user information, and it is determined whether the authentication is successful.
[0154] In this embodiment, there are two methods for user authentication, and users can choose the appropriate authentication method according to their actual usage needs. Specifically, the first authentication method verifies the user's entered account password. It obtains a valid account password corresponding to the user's information based on the user information, and then compares the valid account password with the user's entered account password. If they match, the user is considered authenticated; otherwise, the user is considered unauthenticated. The second authentication method verifies whether the user's biometric information is valid. It obtains valid biometric information corresponding to the user information based on the user information, and then compares the valid biometric information with the user's entered biometric information. If they match, the user is considered authenticated; otherwise, the user is considered unauthenticated.
[0155] If authentication is successful, the step of converting the indicator data query request into a query statement in a preset language will be executed.
[0156] Upon receiving a user's query request for indicator data, this application will first verify the user's identity. Only after the user passes the authentication will the query request be processed. This helps prevent unauthorized users from stealing important data and ensures the compliance and intelligence of the indicator data query request processing.
[0157] It should be emphasized that, in order to further ensure the privacy and security of the aforementioned target indicator data, the aforementioned target indicator data can also be stored in a blockchain node.
[0158] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0159] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0160] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0161] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0162] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0163] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a data query device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0164] like Figure 3 As shown, the data query device 300 described in this embodiment includes: a first receiving module 301, a conversion module 302, a first judging module 303, a second judging module 304, a query module 305, and a first return module 306. Wherein:
[0165] The first receiving module 301 is used to receive the indicator data query request input by the user;
[0166] The conversion module 302 is used to convert the indicator data query request into a query statement in a preset language;
[0167] The first judgment module 303 is used to obtain the query frequency of the query statement based on a preset query statement searcher, and to determine whether the query frequency is less than a preset frequency threshold.
[0168] The second judgment module 304 is used to redirect the query statement to a preset index table if the frequency threshold is not less than the frequency threshold, and to determine whether there is a target index in the index table that matches the query statement.
[0169] The query module 305 is used to retrieve the target indicator data corresponding to the target index from the index table if a target index matching the query statement exists.
[0170] The first return module 306 is used to return the target indicator data to the user's client.
[0171] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0172] In some optional implementations of this embodiment, the data query device further includes:
[0173] The first acquisition module is used to acquire pre-stored historical query statements corresponding to historical indicator data query requests; wherein, the number of historical query statements includes multiple statements.
[0174] The third judgment module is used to obtain the current time and determine whether the current time is within the business idle period.
[0175] The analysis module is used to, if so, decompose and analyze the historical query statement to obtain the duplicate data present in the historical query statement;
[0176] The classification module is used to classify and organize the duplicate data based on a preset algorithm to obtain intermediate data.
[0177] The first calculation module is used to pre-calculate the intermediate data to obtain the corresponding indicator data;
[0178] A construction module is used to construct the index table using the intermediate data and the indicators based on the one-to-one correspondence between the intermediate data and the indicator data.
[0179] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0180] In some optional implementations of this embodiment, the data query device further includes:
[0181] The segmentation module is used to obtain a preset segmentation value and divide a day into multiple processing time periods based on the segmentation value;
[0182] The second acquisition module is used to acquire the total resource consumption for each processing time period within a preset time period based on a preset statistical database.
[0183] The filtering module is used to filter out a first total resource consumption that is greater than a first preset resource threshold from all the total resource consumption, and to determine a first processing time period corresponding to the first total resource consumption.
[0184] The third acquisition module is used to acquire, for each of the first processing time periods, all resource consumption corresponding to the first specified processing time period within the preset time period; wherein, the first specified processing time period is any one of the first processing time periods;
[0185] The fourth judgment module is used to determine whether the consumption of each of the resources is greater than the second preset resource threshold.
[0186] A marking module is used to mark the first specified processing time period as the second processing time period if the condition is met.
[0187] The elimination module is used to eliminate the second processing time period from all the processing time periods to obtain the third processing time period;
[0188] The determination module is used to designate the third processing time period as the business idle time period.
[0189] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned implementation method, and will not be repeated here.
[0190] In some optional implementations of this embodiment, the data query device further includes:
[0191] The fourth acquisition module is used to acquire the occupied capacity value of the index table and the available local storage capacity;
[0192] The second calculation module is used to calculate the difference between the available storage amount and the occupied capacity value;
[0193] The fifth judgment module is used to determine whether the difference is greater than a preset threshold;
[0194] The first storage module is used to store the index table locally if the value is greater than the preset threshold.
[0195] The second storage module is used to store the index table in the blockchain if the value is not greater than the preset threshold.
[0196] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0197] In some optional implementations of this embodiment, the data query device further includes:
[0198] The translation module is used to translate the query statement into the application language if the frequency is less than the frequency threshold.
[0199] The first generation module is used to send the application language to a preset data platform so that the data platform can perform real-time calculations based on the application language to generate corresponding first indicator data.
[0200] The second receiving module is used to receive the first indicator data fed back by the data platform;
[0201] The second return module is used to return the first indicator data to the user's client.
[0202] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0203] In some optional implementations of this embodiment, the data query device further includes:
[0204] The second generation module is used to send the query statement to a preset computing platform if there is no target index that matches the query statement, so that the computing platform can perform real-time calculation based on the query statement to generate corresponding second indicator data.
[0205] The third receiving module is used to receive the second indicator data fed back by the computing platform;
[0206] The third return module is used to return the second indicator data to the user's client.
[0207] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0208] In some optional implementations of this embodiment, the indicator data query request carries the user's user information, and the conversion module 302 includes:
[0209] The acquisition submodule is used to acquire the user information from the indicator data query request;
[0210] The verification submodule is used to authenticate the user based on the user information and determine whether the authentication is successful.
[0211] The execution submodule is used to perform the step of converting the indicator data query request into a query statement in a preset language if the authentication is successful.
[0212] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data query method in the aforementioned embodiments, and will not be repeated here.
[0213] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0214] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0215] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0216] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for data query methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0217] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the data query method.
[0218] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0219] Compared with the prior art, the embodiments of this application have the following main advantages:
[0220] In this embodiment, upon receiving a user-inputted indicator data query request, the request is first converted into a query statement in a preset language. Then, based on a preset query statement searcher, the query frequency of the query statement is obtained, and it is determined whether the query frequency is less than a preset frequency threshold. If it is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether a target index matching the query statement exists in the index table. If a target index matching the query statement exists, the target indicator data corresponding to the target index is retrieved from the index table, and finally, the target indicator data is returned to the user's client. The indicator data query method proposed in this application, by judging the query frequency corresponding to the indicator data query request, when the query statement is identified as a high-frequency query statement, uses a preset index table to quickly retrieve the target indicator data corresponding to the query statement. This skips multiple steps in the full query process, reduces the resource consumption of repeated indicator query operations, and effectively improves the processing efficiency of indicator data queries.
[0221] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the data query method described above.
[0222] Compared with the prior art, the embodiments of this application have the following main advantages:
[0223] In this embodiment, upon receiving a user-inputted indicator data query request, the request is first converted into a query statement in a preset language. Then, based on a preset query statement searcher, the query frequency of the query statement is obtained, and it is determined whether the query frequency is less than a preset frequency threshold. If it is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether a target index matching the query statement exists in the index table. If a target index matching the query statement exists, the target indicator data corresponding to the target index is retrieved from the index table, and finally, the target indicator data is returned to the user's client. The indicator data query method proposed in this application, by judging the query frequency corresponding to the indicator data query request, when the query statement is identified as a high-frequency query statement, uses a preset index table to quickly retrieve the target indicator data corresponding to the query statement. This skips multiple steps in the full query process, reduces the resource consumption of repeated indicator query operations, and effectively improves the processing efficiency of indicator data queries.
[0224] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0225] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A data query method, characterized in that, Includes the following steps: Receive user-input query requests for indicator data; The indicator data query request is converted into a query statement in a preset language; The query frequency of the query statement is obtained based on a preset query statement searcher, and it is determined whether the query frequency is less than a preset frequency threshold. If the frequency is not less than the frequency threshold, the query statement is redirected to a preset index table, and it is determined whether there is a target index in the index table that matches the query statement. If a target index matching the query statement exists, retrieve the target indicator data corresponding to the target index from the index table; The target indicator data is returned to the user's client. Prior to the step of redirecting the query statement to a preset index table, the method further includes: Obtain pre-stored historical query statements corresponding to historical indicator data query requests; wherein, the number of historical query statements includes multiple statements; Get the current time and determine whether the current time is within the business's idle period; If so, the historical query statements are disassembled and analyzed to obtain the duplicate data present in the historical query statements; The duplicate data is classified and organized based on a preset algorithm to obtain intermediate data. The intermediate data is pre-calculated to obtain the corresponding indicator data; Based on the one-to-one correspondence between the intermediate data and the indicator data, the index table is constructed using the intermediate data and the indicators; Prior to the step of obtaining the current time and determining whether the current time falls within a business idle period, the method further includes: Obtain a preset division value, and divide a day into multiple processing time periods based on the division value; Based on a preset statistical database, the total resource consumption for each processing time period within a preset time period is obtained. Filter out the first total resource consumption that is greater than the first preset resource threshold from all the total resource consumption, and determine the first processing time period corresponding to the first total resource consumption; For each of the first processing time periods, obtain all resource consumption corresponding to the first specified processing time period within the preset time period; wherein, the first specified processing time period is any one of the first processing time periods; Determine whether the consumption of each of the aforementioned resources is greater than the second preset resource threshold; If so, mark the first specified processing time period as the second processing time period; The second processing time period is removed from all the processing time periods to obtain the third processing time period; The third processing time period is taken as the business idle time period; The aforementioned statistical database is a database that stores resource consumption data of electronic devices, which refers to memory consumption and CPU consumption.
2. The data query method according to claim 1, characterized in that, After the step of constructing the index table using the intermediate data and the indicators based on the one-to-one correspondence between the intermediate data and the indicator data, the method further includes: Obtain the occupied capacity value of the index table, and obtain the available local storage capacity; Calculate the difference between the available storage and the occupied capacity. Determine whether the difference is greater than a preset threshold; If the value exceeds the preset threshold, the index table will be stored locally. If the value is not greater than the preset threshold, the index table will be stored in the blockchain.
3. The data query method according to claim 1, characterized in that, After the step of determining whether the query frequency is less than a preset frequency threshold, the method further includes: If the frequency is less than the specified threshold, the query statement will be translated into the application language. The application language is sent to a preset data platform so that the data platform can perform real-time calculations based on the application language to generate corresponding first indicator data; Receive the first indicator data fed back by the data platform; The first indicator data is returned to the user's client.
4. The data query method according to claim 1, characterized in that, After the step of determining whether a target index matching the query statement exists in the index table, the method further includes: If no target index matches the query statement, the query statement is sent to a preset computing platform so that the computing platform can perform real-time calculations based on the query statement to generate corresponding second indicator data. Receive the second indicator data fed back by the computing platform; The second indicator data is returned to the user's client.
5. The data query method according to claim 1, characterized in that, The indicator data query request carries the user's user information, and the step of converting the indicator data query request into a query statement in a preset language specifically includes: Obtain the user information from the indicator data query request; The user is authenticated based on the user information, and it is determined whether the authentication is successful. If authentication is successful, the step of converting the indicator data query request into a query statement in a preset language will be executed.
6. A data query device, characterized in that, include: The first receiving module is used to receive user-input query requests for indicator data; The conversion module is used to convert the indicator data query request into a query statement in a preset language; The first judgment module is used to obtain the query frequency of the query statement based on a preset query statement searcher, and to determine whether the query frequency is less than a preset frequency threshold. The second judgment module is used to redirect the query statement to a preset index table if the frequency threshold is not less than the frequency threshold, and to determine whether there is a target index in the index table that matches the query statement. The query module is used to retrieve the target indicator data corresponding to the target index from the index table if a target index matching the query statement exists. The first return module is used to return the target indicator data to the user's client. The data query device also includes: The first acquisition module is used to acquire pre-stored historical query statements corresponding to historical indicator data query requests; wherein, the number of historical query statements includes multiple statements. The third judgment module is used to obtain the current time and determine whether the current time is within the business idle period. The analysis module is used to, if so, decompose and analyze the historical query statement to obtain the duplicate data present in the historical query statement; The classification module is used to classify and organize the duplicate data based on a preset algorithm to obtain intermediate data. The first calculation module is used to pre-calculate the intermediate data to obtain the corresponding indicator data; The construction module is used to construct the index table using the intermediate data and the indicators based on the one-to-one correspondence between the intermediate data and the indicator data; The data query device also includes: The segmentation module is used to obtain a preset segmentation value and divide a day into multiple processing time periods based on the segmentation value; The second acquisition module is used to acquire the total resource consumption for each processing time period within a preset time period based on a preset statistical database. The filtering module is used to filter out a first total resource consumption that is greater than a first preset resource threshold from all the total resource consumption, and to determine a first processing time period corresponding to the first total resource consumption. The third acquisition module is used to acquire, for each of the first processing time periods, all resource consumption corresponding to the first specified processing time period within the preset time period; wherein, the first specified processing time period is any one of the first processing time periods; The fourth judgment module is used to determine whether the consumption of each of the resources is greater than the second preset resource threshold. A marking module is used to mark the first specified processing time period as the second processing time period if the condition is met. The elimination module is used to eliminate the second processing time period from all the processing time periods to obtain the third processing time period; The determination module is used to determine the third processing time period as the business idle time period; The aforementioned statistical database is a database that stores resource consumption data of electronic devices, which refers to memory consumption and CPU consumption.
7. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the data query method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data query method as described in any one of claims 1 to 5.