Application data searching method and device, terminal equipment and storage medium

By calculating hash values ​​to determine partition identification information, partition data in the offline database can be directly queried, solving the problem of slow query speed in traditional offline databases and improving query efficiency.

CN118733609APending Publication Date: 2024-10-01SHENZHEN ANSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410744112.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Traditional offline databases are too slow when querying application data, especially during random queries. They cannot quickly find some data in the table, resulting in the reading of a large amount of irrelevant data, which slows down the query speed.

Method used

By calculating the hash value of the application to be queried, its partition identification information is determined, and the corresponding partition data in the offline target database is queried using this identification information, thus avoiding reading the full table partition file and directly reading the partition file where the application is located.

Benefits of technology

It significantly reduces the number of files read, improves query speed and efficiency, and enables rapid application data querying.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733609A_ABST
    Figure CN118733609A_ABST
Patent Text Reader

Abstract

The invention relates to an application data searching method and device, terminal equipment and a storage medium, and the application data searching method comprises the following steps: obtaining to-be-queried application information, and calculating to obtain a hash value of a to-be-queried application according to the to-be-queried application information; according to the application data query method, the hash value of an application to be queried is calculated, partition identification information of the application to be queried is determined according to the hash value of the application to be queried, and an offline target database is queried according to the partition identification information of the application to be queried to obtain corresponding partition data and output the partition data. And then the partition identification information of the to-be-queried application is calculated and determined according to the hash value of the to-be-queried application, so that the number of files needing to be read is greatly reduced, and the query speed and efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of databases, and in particular to an application data search method, device, terminal device and storage medium. Background Art

[0002] Traditional big data companies use hive for offline databases. Hive has the characteristics of low cost and large-volume query, which is very advantageous in the field of big data analysis. However, hive has its fixed defects, that is, it cannot perform random queries at a relatively fast speed. Especially for the operation of finding devices by application, we only need to find part of the data in the table, and if hive is used for query, it will read all the files in the table to find all the data that meets the conditions. The data is usually distributed in the files under the table in a relatively messy manner, which means that when using hive to find data, a lot of irrelevant data is read, which slows down the query speed. Summary of the invention

[0003] In view of this, the present application provides an application data search method, an application data search device, a terminal device and a storage medium, aiming to solve the technical problem of slow query speed when performing application data query in the above-mentioned offline database.

[0004] An application data search method, comprising: Get the application information to be queried; Calculate the hash value of the application to be queried based on the application information to be queried; Determine the partition identification information of the application to be queried according to the hash value of the application to be queried; The offline target database is queried according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

[0005] In one embodiment, before the step of obtaining the application information to be queried, the step further includes: Get the full device application list data; Calculate the hash value of each application list data; Determine the partition identifier of each application list data according to the hash value of each application list data; According to the partition identification of each application list data, each partition is determined by using the automatic partitioning function of the initial offline database; Each application list data is written into each corresponding partition in the initial offline database to form an offline target database.

[0006] In one embodiment, the step of determining the partition identification information of the application to be queried according to the hash value of the application to be queried includes: The hash value of the application to be queried is modulo the total number of preset partitions to obtain the target value; The target value is used as the partition identification information of the application to be queried.

[0007] In one embodiment, the step of querying the offline target database according to the partition identification information of the application to be queried to obtain the corresponding partition data and outputting it includes: Embed the partition identification information of the application to be queried into the SQL query statement to obtain the target SQL query statement; The offline target database is queried according to the target SQL query statement to obtain the corresponding partition data and output it.

[0008] In addition, an application data search device is also provided, comprising: An acquisition unit, used for acquiring application information to be queried; A first hash value calculation unit, configured to calculate a hash value of the application to be queried according to the application information to be queried; An identification information determining unit, used to determine the partition identification information of the application to be queried according to the hash value of the application to be queried; The data query and output unit is used to query the offline target database according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

[0009] In one embodiment, before the step of obtaining the application information to be queried, the step further includes: A data acquisition unit, used to acquire the full amount of device application list data; A second hash value calculation unit, calculating a hash value of each application list data; an identification determination unit, used to determine a partition identification of each application list data according to a hash value of each application list data; A partition determination unit, used to determine each partition according to the partition identification of each application list data and using the automatic partition function of the initial offline database; The database generation unit writes each application list data into each corresponding partition in the initial offline database to form an offline target database.

[0010] In one embodiment, the identification determination unit includes: A target value generating subunit is used to obtain a target value by modulo a preset partition total value of a hash value of the application to be queried; The identification information generating subunit is used to use the target value as the partition identification information of the application to be queried.

[0011] In one embodiment, the data query and output unit includes: A statement generation subunit is used to embed the partition identification information of the application to be queried into the SQL query statement to obtain a target SQL query statement; The data output subunit is used to query the offline target database according to the target SQL query statement to obtain the corresponding partition data and output it.

[0012] To achieve the above objectives, the present application also provides a terminal device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the above-mentioned application data search method are implemented.

[0013] To achieve the above objectives, the present application also provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned application data search method are implemented.

[0014] The above-mentioned application data search method obtains the application information to be queried, and calculates the hash value of the application to be queried based on the application information to be queried; determines the partition identification information of the application to be queried based on the hash value of the application to be queried, and queries the offline target database based on the partition identification information of the application to be queried to obtain the corresponding partition data and outputs it. The application data query method first calculates the hash value of the application to be queried, and then determines the partition identification information of the application to be queried based on the hash value of the application to be queried, and then performs subsequent data query based on the partition identification information. In other words, it is only necessary to read the file of the partition where the application itself is located for query, without having to read the full table partition in the offline database for query, which greatly reduces the number of files that need to be read and improves the query speed and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flowchart of an application data search method in an embodiment of the present application; Figure 2 This is a flowchart of an application data search method in another embodiment of the present application; Figure 3 A schematic diagram of a method flow for obtaining partition identification information of an application to be queried in an embodiment of the present application; Figure 4 This is a flow chart of a method for obtaining and outputting corresponding partition data in an embodiment of the present application; Figure 5 A structural block diagram of an application data search device provided by an embodiment of the present application; Figure 6 A structural block diagram of an application data search device provided by another embodiment of the present application; Figure 7 A structural block diagram of an identification determination unit provided in one embodiment of the present application; Figure 8 A structural block diagram of a data query and output unit provided in an embodiment of the present application; Fig. 9 A schematic block diagram of the internal structure of a terminal device provided in one embodiment of the present application.

[0016] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0017] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0018] In addition, if the descriptions of "first", "second", etc. are involved in this application, they are only used for descriptive purposes (such as for distinguishing the same or similar elements), and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0019] like Figure 1 As shown, a method for searching application data includes: Step S110, obtaining application information to be queried.

[0020] Step S120: Calculate the hash value of the application to be queried according to the application information to be queried.

[0021] Step S130, determining the partition identification information of the application to be queried according to the hash value of the application to be queried.

[0022] Step S140: query the offline target database according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

[0023] The above-mentioned application data search method obtains the application information to be queried, and calculates the hash value of the application to be queried based on the application information to be queried; determines the partition identification information of the application to be queried based on the hash value of the application to be queried, and queries the offline target database based on the partition identification information of the application to be queried to obtain the corresponding partition data and outputs it. The application data query method first calculates the hash value of the application to be queried, and then determines the partition identification information of the application to be queried based on the hash value of the application to be queried, and then performs subsequent data query based on the partition identification information. In other words, it is only necessary to read the file data of the partition where the application itself is located for query, without having to read the file data of the entire table partition in the offline database for query, which greatly reduces the number of files that need to be read and improves the query speed and efficiency.

[0024] In one embodiment, Figure 2 As shown, before step S110, the following steps are also included: Step S150, obtaining a full amount of device application list data.

[0025] Step S160, calculating the hash value of each application list data.

[0026] When calculating the hash value of each application list data, a custom function is loaded for calculation.

[0027] For example, if you customize the pkg_mod function, you might set this value to pkg_mod=i.

[0028] Step S170: determining the partition identifier of each application list data according to the hash value of each application list data.

[0029] Step S180, according to the partition identifier of each application list data, each partition is determined by using the automatic partition function of the initial offline database.

[0030] Step S190, writing each application list data into each corresponding partition in the initial offline database to form an offline target database.

[0031] In this embodiment, by predetermining the partition identifier of each application list data, and then determining each partition based on the partition identifier of each application list data using the automatic partitioning function of the initial offline database, and finally determining each partition using the automatic partitioning function of the initial offline database, each application list data is pre-written into the corresponding partition, laying the foundation for the execution process of subsequent steps S110 to S140.

[0032] In one embodiment, Figure 3 As shown, step S130 includes: S132, taking the modulus of the hash value of the application to be queried and the total number of preset partitions to obtain a target value.

[0033] The preset total number of partitions is an empirical value and is set according to actual needs. Usually, 1000 partitions are used.

[0034] S134: Use the target value as the partition identification information of the application to be queried.

[0035] In this embodiment, by taking the hash value of the application to be queried modulo the preset total number of partitions as the partition identification information of the application to be queried, the partitions corresponding to different applications can be accurately distinguished, laying a foundation for the subsequent query process.

[0036] In one embodiment, Figure 4 As shown, step S140 includes: Step S142: embed the partition identification information of the application to be queried into an SQL query statement to obtain a target SQL query statement.

[0037] Step S144, querying the offline target database according to the target SQL query statement to obtain the corresponding partition data and output it.

[0038] In this embodiment, by embedding the partition identification information of the application to be queried into the SQL query statement, the offline target database can be effectively queried to obtain the corresponding partition data and output it.

[0039] In addition, if Figure 5 As shown, an application data search device 200 is also provided, comprising: An acquisition unit 210 is used to acquire application information to be queried; A first hash value calculation unit 220, configured to calculate a hash value of the application to be queried according to the application information to be queried; The identification information determining unit 230 is used to determine the partition identification information of the application to be queried according to the hash value of the application to be queried; The data query and output unit 240 is used to query the offline target database according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

[0040] In one embodiment, Figure 6 As shown, the above-mentioned application data search device 200 also includes: The data acquisition unit 250 is used to acquire the full amount of device application list data; A second hash value calculation unit 260, used to calculate the hash value of each application list data; An identification determination unit 270, configured to determine a partition identification of each application list data according to a hash value of each application list data; A partition determination unit 280, configured to determine each partition according to the partition identification of each application list data by using the automatic partition function of the initial offline database; The database generating unit 290 writes each application list data into each corresponding partition in the initial offline database to form an offline target database.

[0041] In one embodiment, Figure 7 As shown, the identification determination unit 270 includes: The target value generating subunit 272 is used to obtain a target value by modulo the hash value of the application to be queried and the total number of preset partitions; The identification information generating subunit 274 is used to use the target value as the partition identification information of the application to be queried.

[0042] In one embodiment, Figure 8 As shown, the data query and output unit 240 includes: The statement generation subunit 242 is used to embed the partition identification information of the application to be queried into the SQL query statement to obtain the target SQL query statement; The data output subunit 244 is used to query the offline target database according to the target SQL query statement to obtain the corresponding partition data and output it.

[0043] In addition, a terminal device is also provided in an embodiment of the present application. The internal structure of the terminal device can be as follows: Fig. 9 As shown. The terminal device includes a processor, a memory, a communication interface and a database connected via a system bus. The processor is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the terminal device is used to store data called by the computer program. The communication interface of the terminal device is used to communicate data with an external terminal. The input device of the terminal device is used to receive a signal input by an external device. When the computer program is executed by the processor, an application data search method as in the above embodiment is implemented.

[0044] Those skilled in the art will understand that Fig. 9 The structure shown in is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the terminal device to which the solution of the present application is applied.

[0045] In addition, the present application also proposes a storage medium, the storage medium includes a computer program, and when the computer program is executed by a processor, the steps of the application data search method in the above embodiment are implemented. It can be understood that the storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0046] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0047] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0048] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for searching application data, characterized in that: include: Get the application information to be queried; Calculate the hash value of the application to be queried according to the application information to be queried; Determine the partition identification information of the application to be queried according to the hash value of the application to be queried; The offline target database is queried according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

2. The application data search method according to claim 1, characterized in that: Before the step of obtaining the application information to be queried, the following step is also included: Get the full device application list data; Calculate the hash value of each application list data; Determine the partition identifier of each application list data according to the hash value of each application list data; According to the partition identification of each application list data, each partition is determined by using the automatic partitioning function of the initial offline database; Each application list data is written into each corresponding partition in the initial offline database to form an offline target database.

3. The application data search method according to claim 1, characterized in that: The step of determining the partition identification information of the application to be queried according to the hash value of the application to be queried comprises: The hash value of the application to be queried is modulo the total number of preset partitions to obtain a target value; The target value is used as the partition identification information of the application to be queried.

4. The application data search method according to claim 2, characterized in that: The step of querying the offline target database according to the partition identification information of the application to be queried to obtain corresponding partition data and outputting the data comprises: Embed the partition identification information of the application to be queried into an SQL query statement to obtain a target SQL query statement; The offline target database is queried according to the target SQL query statement to obtain the corresponding partition data and output it.

5. An application data search device, characterized in that: include: An acquisition unit, used for acquiring application information to be queried; A first hash value calculation unit, configured to calculate a hash value of the application to be queried according to the application information to be queried; an identification information determining unit, configured to determine the partition identification information of the application to be queried according to the hash value of the application to be queried; The data query and output unit is used to query the offline target database according to the partition identification information of the application to be queried to obtain the corresponding partition data and output it.

6. The application data search device according to claim 1, characterized in that: Also includes: A data acquisition unit, used to acquire the full amount of device application list data; A second hash value calculation unit, calculating a hash value of each application list data; an identification determination unit, used to determine a partition identification of each application list data according to a hash value of each application list data; A partition determination unit, used to determine each partition according to the partition identification of each application list data and using the automatic partition function of the initial offline database; The database generating unit writes each application list data into each corresponding partition in the initial offline database to form an offline target database.

7. The application data search device according to claim 1, characterized in that: The identification determination unit comprises: A target value generating subunit, configured to obtain a target value by modulo a preset partition total value of the hash value of the application to be queried; The identification information generating subunit is used to use the target value as the partition identification information of the application to be queried.

8. The application data search device according to claim 2, characterized in that: The data query and output unit comprises: A statement generation subunit, used for embedding the partition identification information of the application to be queried into the SQL query statement to obtain a target SQL query statement; The data output subunit is used to query the offline target database according to the target SQL query statement to obtain the corresponding partition data and output it.

9. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the application data search method according to any one of claims 1 to 4 are implemented.

10. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the application data search method according to any one of claims 1 to 4.