CN111814045B - Data query method, device, electronic equipment and storage medium - Google Patents
Data query method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111814045B CN111814045B CN202010624353.4A CN202010624353A CN111814045B CN 111814045 B CN111814045 B CN 111814045B CN 202010624353 A CN202010624353 A CN 202010624353A CN 111814045 B CN111814045 B CN 111814045B
- Authority
- CN
- China
- Prior art keywords
- query
- data
- preset
- target
- condition
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000013507 mapping Methods 0.000 claims abstract description 38
- 238000012545 processing Methods 0.000 claims abstract description 15
- 238000012216 screening Methods 0.000 claims description 19
- 238000012544 monitoring process Methods 0.000 claims description 16
- 238000004422 calculation algorithm Methods 0.000 claims description 7
- 239000002699 waste material Substances 0.000 abstract description 6
- 238000004590 computer program Methods 0.000 description 16
- 230000006870 function Effects 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 6
- 238000013500 data storage Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000001960 triggered effect Effects 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000007405 data analysis Methods 0.000 description 2
- 235000019800 disodium phosphate Nutrition 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003203 everyday effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to data processing and provides a data query method, a data query device, electronic equipment and a storage medium. The method can acquire preset parameters and query objects, determine the dimension of the preset parameters, determine the logic instruction of the preset parameters according to the dimension, splice the preset parameters according to the logic instruction, acquire a plurality of query conditions, determine the query frequency of each query condition, select target conditions from the plurality of query conditions based on the query frequency, query the query objects by using the target conditions to acquire query data, cache the mapping relation between the query data and the target conditions to acquire a cache file, acquire configuration conditions from the data query request when the data query request is received, and acquire the target data from the cache file according to the configuration conditions. The invention not only can improve the data query efficiency, but also can avoid the phenomenon of resource waste. Furthermore, the present invention relates to blockchain techniques in which the target data may be stored.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data query method, a data query device, an electronic device, and a storage medium.
Background
Aiming at the data query of a report system with large data volume, the problem of low query efficiency exists, however, the problem of user loss is caused by poor experience caused by the low query efficiency, the current mode is to improve the data query efficiency by utilizing multi-thread concurrent processing, however, the mode can repeatedly query the same query condition in a short time, and the phenomenon of resource waste is caused.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a data query method, apparatus, electronic device, and storage medium, which can not only improve data query efficiency, but also avoid the phenomenon of resource waste.
A data query method, the data query method comprising:
acquiring preset parameters and query objects;
determining the dimension of the preset parameter, and determining a logic instruction of the preset parameter according to the dimension;
Splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
Determining a query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency;
Inquiring the inquiring object by utilizing the target condition to obtain inquiring data, and caching the mapping relation between the inquiring data and the target condition to obtain a cache file;
When a data query request is received, acquiring configuration conditions from the data query request;
and acquiring target data from the cache file according to the configuration condition.
According to a preferred embodiment of the present invention, the logic instruction for determining the dimension to which the preset parameter belongs and determining the preset parameter according to the dimension includes:
Acquiring a preset mapping relation table;
Acquiring dimensions corresponding to the preset parameters from the preset mapping relation table;
Acquiring a preset dimension table;
and acquiring a logic instruction corresponding to the dimension from the preset dimension table.
According to a preferred embodiment of the present invention, before determining the query frequency of each query condition, the data query method further includes:
encrypting each inquiry condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each inquiry condition;
Inserting a monitoring code into the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is detected to be queried, determining the query frequency of the any query condition;
And storing the mapping relation of each query condition, each ciphertext and each query frequency to obtain a log table.
According to a preferred embodiment of the present invention, the determining the query frequency of each query condition, and selecting the target condition from the plurality of query conditions based on the query frequency includes:
Acquiring the query frequency of each query condition from the log table;
Ordering the plurality of query conditions according to the sequence of the query frequency from big to small to obtain a target queue;
Acquiring a preset numerical value;
And acquiring the first N inquiry conditions from the target queue, wherein the value of N is the preset value as the target condition.
According to a preferred embodiment of the present invention, the querying the query object using the target condition includes:
Acquiring query parameters in the target conditions;
determining the parameter quantity of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the plurality of idle threads is the same as the number of the parameters;
screening the data in the query object by utilizing the plurality of idle threads based on the query parameters to obtain primary screening data;
and processing the preliminary screening data based on the logic instruction in the target condition to obtain the query data.
According to a preferred embodiment of the present invention, the obtaining the configuration condition from the data query request includes:
Acquiring a target thread from the preset thread connection pool;
analyzing the method body of the data query request by using the target thread to obtain all information carried by the data query request;
Acquiring a preset label;
And acquiring information corresponding to the preset label from all the information to serve as the configuration condition.
According to a preferred embodiment of the present invention, the target data is stored in a blockchain, and after the target data is obtained from the cache file according to the configuration condition, the data query method further includes:
determining a data format from the data query request;
detecting whether the target data is in the data format;
and when the target data is not in the data format, converting the target data into data with the data format, and updating the converted data to a blockchain.
A data query apparatus, the data query apparatus comprising:
the acquisition unit is used for acquiring preset parameters and query objects;
the determining unit is used for determining the dimension of the preset parameter and determining a logic instruction of the preset parameter according to the dimension;
The splicing unit is used for splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
the determining unit is further configured to determine a query frequency of each query condition, and select a target condition from the plurality of query conditions based on the query frequency;
the query unit is used for querying the query object by utilizing the target condition to obtain query data, and caching the mapping relation between the query data and the target condition to obtain a cache file;
the acquisition unit is further used for acquiring configuration conditions from the data query request when the data query request is received;
the obtaining unit is further configured to obtain target data from the cache file according to the configuration condition.
An electronic device, the electronic device comprising:
A memory storing at least one instruction; and
And the processor executes the instructions stored in the memory to realize the data query method.
A computer-readable storage medium having stored therein at least one instruction for execution by a processor in an electronic device to implement the data query method.
According to the technical scheme, the logic instruction of the preset parameter is determined, so that the splice rule of the preset parameter is determined, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; the method comprises the steps of determining the query frequency of each query condition, selecting target conditions from a plurality of query conditions based on the query frequency, rapidly and accurately determining the target conditions possibly used by a user, further querying the query object by utilizing the target conditions to obtain query data, and caching the mapping relation between the query data and the target conditions to obtain a cache file. Furthermore, when a user initiates a query, target data can be quickly obtained from the cache file, so that the data query efficiency is improved, and meanwhile, as the target data can be directly obtained from the cache file when the user initiates the query, repeated query can not be performed on the same query condition, and therefore, the phenomenon of resource waste can be avoided.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the data query method of the present invention.
FIG. 2 is a functional block diagram of a preferred embodiment of the data query device of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing a data query method.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a preferred embodiment of the data query method of the present invention. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
The data query method is applied to one or more electronic devices, wherein the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware of the electronic devices comprises, but is not limited to, microprocessors, application SPECIFIC INTEGRATED Circuits (ASICs), programmable gate arrays (Field-Programmable GATE ARRAY, FPGA), digital processors (DIGITAL SIGNAL processors, DSPs), embedded devices and the like.
The electronic device may be any electronic product that can interact with a user in a human-computer manner, such as a Personal computer, a tablet computer, a smart phone, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), a game console, an interactive internet protocol television (Internet Protocol Television, IPTV), a smart wearable device, etc.
The electronic device may also include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group composed of a plurality of network servers, or a Cloud based Cloud Computing (Cloud Computing) composed of a large number of hosts or network servers.
The network in which the electronic device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
S10, acquiring preset parameters and query objects.
In at least one embodiment of the present invention, the preset parameters may be obtained from a client connected to the electronic device, or may be obtained from a cloud, and the source of obtaining the preset parameters is not limited in the present invention.
Further, the preset parameter may be a parameter set by a user in advance, for example: the preset parameters may be teenager population, and the preset parameters may also be life insurance, etc.
In at least one embodiment of the invention, the query object refers to a reporting system that stores data. The query object may be obtained from a terminal device set by a user.
S11, determining the dimension of the preset parameter, and determining a logic instruction of the preset parameter according to the dimension.
In at least one embodiment of the present invention, the dimensions may include, but are not limited to: risk, user, date, institution, etc.
Further, the logical instruction refers to a parameter and logic between parameters, including, but not limited to: nested, and, or the like.
In at least one embodiment of the present invention, the determining, by the electronic device, a dimension to which the preset parameter belongs, and determining, according to the dimension, a logic instruction of the preset parameter includes:
Acquiring a preset mapping relation table;
Acquiring dimensions corresponding to the preset parameters from the preset mapping relation table;
Acquiring a preset dimension table;
and acquiring a logic instruction corresponding to the dimension from the preset dimension table.
The mapping relation table stores the mapping relation between the parameters and the dimensions, and further stores the mapping relation between the dimensions and the logic instructions.
Through the mapping relation between the parameters and the dimensions and the mapping relation between the dimensions and the logic instructions, the logic instructions of the preset parameters can be accurately determined.
And S12, splicing the preset parameters according to the logic instruction to obtain a plurality of query conditions.
In at least one embodiment of the present invention, the plurality of query conditions are generated as a result of the logic instructions and the predetermined parameter determination.
For example: when the logic instruction is: and, when the preset parameters are the parameters A, B and C, the query condition is the parameters A and B and C.
By the method, the query condition with the preset parameters can be accurately generated.
S13, determining the query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency.
In at least one embodiment of the present invention, the query frequency refers to the number of times a user makes a query using a query condition.
Further, the target condition refers to a query condition which is frequently queried by a user.
In at least one embodiment of the present invention, before determining the query frequency of each query condition, the data query method further includes:
encrypting each inquiry condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each inquiry condition;
Inserting a monitoring code into the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is detected to be queried, determining the query frequency of the any query condition;
And storing the mapping relation of each query condition, each ciphertext and each query frequency to obtain a log table.
By conducting encryption processing on the query conditions, the query conditions are prevented from being tampered, the security of the query conditions is improved, meanwhile, the encryption rate can be improved by utilizing a symmetric encryption algorithm to encrypt, whether the query conditions are queried or not can be monitored in real time through monitoring codes, and then the query frequency of the query conditions can be accurately determined.
In at least one embodiment of the present invention, the electronic device determining a query frequency for each query condition and selecting a target condition from the plurality of query conditions based on the query frequency comprises:
Acquiring the query frequency of each query condition from the log table;
Ordering the plurality of query conditions according to the sequence of the query frequency from big to small to obtain a target queue;
Acquiring a preset numerical value;
And acquiring the first N inquiry conditions from the target queue, wherein the value of N is the preset value as the target condition.
The preset numerical value can be set according to an actual application scene, and the invention does not limit the value of the preset numerical value.
By the above embodiment, the query condition in which the user frequently queries can be determined as the target condition.
S14, inquiring the inquired object by utilizing the target condition to obtain inquired data, and caching the mapping relation between the inquired data and the target condition to obtain a cache file.
In at least one embodiment of the present invention, the query data refers to data queried from the query object using the target condition.
Further, the data queried from the query object by using the target condition is stored in the cache file.
In at least one embodiment of the present invention, the electronic device querying the query object using the target condition, where obtaining query data includes:
Acquiring query parameters in the target conditions;
determining the parameter quantity of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the plurality of idle threads is the same as the number of the parameters;
screening the data in the query object by utilizing the plurality of idle threads based on the query parameters to obtain primary screening data;
and processing the preliminary screening data based on the logic instruction in the target condition to obtain the query data.
The preset thread connection pool stores the plurality of idle threads.
By acquiring the idle threads from the preset thread connection pool, the time spent for creating the threads can be reduced, the data screening efficiency is further improved, and accurate query data can be obtained by processing the primary screening data.
In at least one embodiment of the present invention, after obtaining the cached file, the method further comprises:
Determining the level of the cache file according to the target condition;
generating prompt information according to the cache file;
determining a sending mode of the prompt information according to the grade;
and sending the prompt information to the terminal equipment of the appointed contact person in the sending mode.
Wherein the grades include, but are not limited to: grade one, grade two, etc.
The transmission modes include, but are not limited to: mail mode, telephone mode, etc.
Through the embodiment, after the cache file is obtained, the appointed contact person can be timely informed to check, and meanwhile, the prompt information can be sent in a proper sending mode through determining the grade.
S15, when a data query request is received, acquiring configuration conditions from the data query request.
In at least one embodiment of the present invention, the data query request may be triggered by an analyst responsible for data analysis, or may be triggered at a preset time.
The preset time can be seven points in the morning every day, and the specific value of the preset time is not limited by the invention.
In at least one embodiment of the present invention, the information carried in the data query request includes, but is not limited to: presetting a label, the configuration condition and the like.
In at least one embodiment of the present invention, the electronic device obtaining the configuration condition from the data query request includes:
Acquiring a target thread from the preset thread connection pool;
analyzing the method body of the data query request by using the target thread to obtain all information carried by the data query request;
Acquiring a preset label;
And acquiring information corresponding to the preset label from all the information to serve as the configuration condition.
The preset label refers to a predefined label, for example: a name.
Further, the target thread may be any thread in an idle state.
By analyzing the method body of the data query request, all information carried in the data query request can be obtained quickly, the analysis speed is improved, and further, the configuration conditions can be determined accurately through the mapping relation between preset labels and the configuration conditions.
S16, acquiring target data from the cache file according to the configuration conditions.
It is emphasized that the target data may also be stored in a blockchain node in order to further ensure the privacy and security of the target data.
In at least one embodiment of the present invention, the electronic device obtaining, according to the configuration condition, target data from the cache file includes:
determining a target condition corresponding to the configuration condition;
Determining a data storage path corresponding to the target condition from the cache file;
And acquiring the target data from the data storage path.
By the embodiment, the target data can be directly obtained from the cache file, so that the data query efficiency can be improved.
In at least one embodiment of the present invention, the target data is stored in a blockchain, and after the target data is obtained from the cache file according to the configuration condition, the data query method further includes:
determining a data format from the data query request;
detecting whether the target data is in the data format;
and when the target data is not in the data format, converting the target data into data with the data format, and updating the converted data to a blockchain.
The data format may be text format in the form of characters or compressed format in the form of binary data.
By the implementation mode, the data queried by the user can be ensured to meet the requirement of the data format.
According to the technical scheme, the logic instruction of the preset parameter is determined, so that the splice rule of the preset parameter is determined, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; the method comprises the steps of determining the query frequency of each query condition, selecting target conditions from a plurality of query conditions based on the query frequency, rapidly and accurately determining the target conditions possibly used by a user, further querying the query object by utilizing the target conditions to obtain query data, and caching the mapping relation between the query data and the target conditions to obtain a cache file. Furthermore, when a user initiates a query, target data can be quickly obtained from the cache file, so that the data query efficiency is improved, and meanwhile, as the target data can be directly obtained from the cache file when the user initiates the query, repeated query can not be performed on the same query condition, and therefore, the phenomenon of resource waste can be avoided.
FIG. 2 is a functional block diagram of a preferred embodiment of the data query device of the present invention. The data query device 11 includes an acquisition unit 110, a determination unit 111, a concatenation unit 112, a query unit 113, an encryption unit 114, a monitoring unit 115, a storage unit 116, a detection unit 117, a conversion unit 118, a generation unit 119, and a transmission unit 120. The module/unit referred to in the present invention refers to a series of computer program segments capable of being executed by the processor 13 and of performing a fixed function, which are stored in the memory 12. In the present embodiment, the functions of the respective modules/units will be described in detail in the following embodiments.
The acquiring unit 110 acquires a preset parameter and a query object.
In at least one embodiment of the present invention, the preset parameters may be obtained from a client connected to the electronic device, or may be obtained from a cloud, and the source of obtaining the preset parameters is not limited in the present invention.
Further, the preset parameter may be a parameter set by a user in advance, for example: the preset parameters may be teenager population, and the preset parameters may also be life insurance, etc.
In at least one embodiment of the invention, the query object refers to a reporting system that stores data. The query object may be obtained from a terminal device set by a user.
The determining unit 111 determines the dimension to which the preset parameter belongs, and determines the logic instruction of the preset parameter according to the dimension.
In at least one embodiment of the present invention, the dimensions may include, but are not limited to: risk, user, date, institution, etc.
Further, the logical instruction refers to a parameter and logic between parameters, including, but not limited to: nested, and, or the like.
In at least one embodiment of the present invention, the determining unit 111 determines a dimension to which the preset parameter belongs, and the logic instruction for determining the preset parameter according to the dimension includes:
Acquiring a preset mapping relation table;
Acquiring dimensions corresponding to the preset parameters from the preset mapping relation table;
Acquiring a preset dimension table;
and acquiring a logic instruction corresponding to the dimension from the preset dimension table.
The mapping relation table stores the mapping relation between the parameters and the dimensions, and further stores the mapping relation between the dimensions and the logic instructions.
Through the mapping relation between the parameters and the dimensions and the mapping relation between the dimensions and the logic instructions, the logic instructions of the preset parameters can be accurately determined.
The splicing unit 112 splices the preset parameters according to the logic instruction to obtain a plurality of query conditions.
In at least one embodiment of the present invention, the plurality of query conditions are generated as a result of the logic instructions and the predetermined parameter determination.
For example: when the logic instruction is: and, when the preset parameters are the parameters A, B and C, the query condition is the parameters A and B and C.
By the method, the query condition with the preset parameters can be accurately generated.
The determination unit 111 determines a query frequency of each query condition, and selects a target condition from the plurality of query conditions based on the query frequency.
In at least one embodiment of the present invention, the query frequency refers to the number of times a user makes a query using a query condition.
Further, the target condition refers to a query condition which is frequently queried by a user.
In at least one embodiment of the present invention, before determining the query frequency of each query condition, the encryption unit 114 encrypts each query condition using a symmetric encryption algorithm to obtain a ciphertext of each query condition;
The monitoring unit 115 inserts a monitoring code in the query object, and monitors whether the query condition is queried using the monitoring code;
when it is monitored that any query condition is queried, the determining unit 111 determines a query frequency of the any query condition;
The storage unit 116 stores the mapping relation of each query condition, each ciphertext, and each query frequency, and obtains a log table.
By conducting encryption processing on the query conditions, the query conditions are prevented from being tampered, the security of the query conditions is improved, meanwhile, the encryption rate can be improved by utilizing a symmetric encryption algorithm to encrypt, whether the query conditions are queried or not can be monitored in real time through monitoring codes, and then the query frequency of the query conditions can be accurately determined.
In at least one embodiment of the present invention, the determining unit 111 determines a query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency includes:
Acquiring the query frequency of each query condition from the log table;
Ordering the plurality of query conditions according to the sequence of the query frequency from big to small to obtain a target queue;
Acquiring a preset numerical value;
And acquiring the first N inquiry conditions from the target queue, wherein the value of N is the preset value as the target condition.
The preset numerical value can be set according to an actual application scene, and the invention does not limit the value of the preset numerical value.
By the above embodiment, the query condition in which the user frequently queries can be determined as the target condition.
The query unit 113 queries the query object by using the target condition to obtain query data, and caches a mapping relationship between the query data and the target condition to obtain a cache file.
In at least one embodiment of the present invention, the query data refers to data queried from the query object using the target condition.
Further, the data queried from the query object by using the target condition is stored in the cache file.
In at least one embodiment of the present invention, the querying unit 113 queries the query object using the target condition, and obtains query data includes:
Acquiring query parameters in the target conditions;
determining the parameter quantity of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the plurality of idle threads is the same as the number of the parameters;
screening the data in the query object by utilizing the plurality of idle threads based on the query parameters to obtain primary screening data;
and processing the preliminary screening data based on the logic instruction in the target condition to obtain the query data.
The preset thread connection pool stores the plurality of idle threads.
By acquiring the idle threads from the preset thread connection pool, the time spent for creating the threads can be reduced, the data screening efficiency is further improved, and accurate query data can be obtained by processing the primary screening data.
In at least one embodiment of the present invention, after obtaining a cached file, the determining unit 111 determines a level of the cached file according to the target condition;
The generating unit 119 generates prompt information according to the cache file;
The determining unit 111 determines a transmission mode of the prompt message according to the level;
the sending unit 120 sends the prompt message to the terminal device of the designated contact person in the sending mode.
Wherein the grades include, but are not limited to: grade one, grade two, etc.
The transmission modes include, but are not limited to: mail mode, telephone mode, etc.
Through the embodiment, after the cache file is obtained, the appointed contact person can be timely informed to check, and meanwhile, the prompt information can be sent in a proper sending mode through determining the grade.
When receiving a data query request, the acquiring unit 110 acquires a configuration condition from the data query request.
In at least one embodiment of the present invention, the data query request may be triggered by an analyst responsible for data analysis, or may be triggered at a preset time.
The preset time can be seven points in the morning every day, and the specific value of the preset time is not limited by the invention.
In at least one embodiment of the present invention, the information carried in the data query request includes, but is not limited to: presetting a label, the configuration condition and the like.
In at least one embodiment of the present invention, the obtaining unit 110 obtains the configuration condition from the data query request includes:
Acquiring a target thread from the preset thread connection pool;
analyzing the method body of the data query request by using the target thread to obtain all information carried by the data query request;
Acquiring a preset label;
And acquiring information corresponding to the preset label from all the information to serve as the configuration condition.
The preset label refers to a predefined label, for example: a name.
Further, the target thread may be any thread in an idle state.
By analyzing the method body of the data query request, all information carried in the data query request can be obtained quickly, the analysis speed is improved, and further, the configuration conditions can be determined accurately through the mapping relation between preset labels and the configuration conditions.
The obtaining unit 110 obtains target data from the cache file according to the configuration condition.
It is emphasized that the target data may also be stored in a blockchain node in order to further ensure the privacy and security of the target data.
In at least one embodiment of the present invention, the obtaining unit 110 obtains target data from the cache file according to the configuration condition includes:
determining a target condition corresponding to the configuration condition;
Determining a data storage path corresponding to the target condition from the cache file;
And acquiring the target data from the data storage path.
By the embodiment, the target data can be directly obtained from the cache file, so that the data query efficiency can be improved.
In at least one embodiment of the present invention, the target data is stored in a blockchain, and the determining unit 111 determines a data format from the data query request after acquiring the target data from the cache file according to the configuration condition;
The detection unit 117 detects whether the target data is in the data format;
when the target data is not in the data format, the conversion unit 118 converts the target data into data having the data format and updates the converted data to a blockchain.
The data format may be text format in the form of characters or compressed format in the form of binary data.
By the implementation mode, the data queried by the user can be ensured to meet the requirement of the data format.
According to the technical scheme, the logic instruction of the preset parameter is determined, so that the splice rule of the preset parameter is determined, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; the method comprises the steps of determining the query frequency of each query condition, selecting target conditions from a plurality of query conditions based on the query frequency, rapidly and accurately determining the target conditions possibly used by a user, further querying the query object by utilizing the target conditions to obtain query data, and caching the mapping relation between the query data and the target conditions to obtain a cache file. Furthermore, when a user initiates a query, target data can be quickly obtained from the cache file, so that the data query efficiency is improved, and meanwhile, as the target data can be directly obtained from the cache file when the user initiates the query, repeated query can not be performed on the same query condition, and therefore, the phenomenon of resource waste can be avoided.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing the data query method.
In one embodiment of the invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and a computer program, such as a data query program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and may include more or less components than illustrated, or may combine certain components, or different components, e.g. the electronic device 1 may further include input-output devices, network access devices, buses, etc.
The Processor 13 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor, etc., and the processor 13 is an operation core and a control center of the electronic device 1, connects various parts of the entire electronic device 1 using various interfaces and lines, and executes an operating system of the electronic device 1 and various installed applications, program codes, etc.
The processor 13 executes the operating system of the electronic device 1 and various types of applications installed. The processor 13 executes the application program to implement the steps of the various data query method embodiments described above, such as the steps shown in fig. 1.
Or the processor 13, when executing the computer program, performs the functions of the modules/units in the above-described device embodiments, for example:
acquiring preset parameters and query objects;
determining the dimension of the preset parameter, and determining a logic instruction of the preset parameter according to the dimension;
Splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
Determining a query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency;
Inquiring the inquiring object by utilizing the target condition to obtain inquiring data, and caching the mapping relation between the inquiring data and the target condition to obtain a cache file;
When a data query request is received, acquiring configuration conditions from the data query request;
and acquiring target data from the cache file according to the configuration condition.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules/units may be a series of instruction segments of a computer program capable of performing a specific function for describing the execution of the computer program in the electronic device 1. For example, the computer program may be divided into an acquisition unit 110, a determination unit 111, a concatenation unit 112, a query unit 113, an encryption unit 114, a monitoring unit 115, a saving unit 116, a detection unit 117, a conversion unit 118, a generation unit 119, and a transmission unit 120.
The memory 12 may be used to store the computer program and/or module, and the processor 13 may implement various functions of the electronic device 1 by running or executing the computer program and/or module stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, the memory 12 may include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card (SMART MEDIA CARD, SMC), secure Digital (SD) card, flash memory card (FLASH CARD), at least one disk storage device, flash memory device, or other non-volatile solid-state storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a physical memory, such as a memory bank, a TF card (Trans-FLASH CARD), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above.
Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
In connection with fig. 1, the memory 12 in the electronic device 1 stores a plurality of instructions to implement a data query method, the processor 13 being executable to implement:
acquiring preset parameters and query objects;
determining the dimension of the preset parameter, and determining a logic instruction of the preset parameter according to the dimension;
Splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
Determining a query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency;
Inquiring the inquiring object by utilizing the target condition to obtain inquiring data, and caching the mapping relation between the inquiring data and the target condition to obtain a cache file;
When a data query request is received, acquiring configuration conditions from the data query request;
and acquiring target data from the cache file according to the configuration condition.
Specifically, the specific implementation method of the above instructions by the processor 13 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.
Claims (7)
1. A data query method, the data query method comprising:
acquiring preset parameters and query objects;
Determining the dimension to which the preset parameter belongs, and determining the logic instruction of the preset parameter according to the dimension, wherein the logic instruction comprises the following steps: acquiring a preset mapping relation table; acquiring dimensions corresponding to the preset parameters from the preset mapping relation table; acquiring a preset dimension table; acquiring a logic instruction corresponding to the dimension from the preset dimension table;
Splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
Determining a query frequency of each query condition, and selecting a target condition from the plurality of query conditions based on the query frequency;
Querying the query object by using the target condition to obtain query data, including: acquiring query parameters in the target conditions; determining the parameter quantity of the query parameters; acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the plurality of idle threads is the same as the number of the parameters; screening the data in the query object by utilizing the plurality of idle threads based on the query parameters to obtain primary screening data; processing the preliminary screening data based on the logic instruction in the target condition to obtain the query data, and caching the mapping relation between the query data and the target condition to obtain a cache file;
When a data query request is received, acquiring configuration conditions from the data query request comprises: acquiring a target thread from the preset thread connection pool; analyzing the method body of the data query request by using the target thread to obtain all information carried by the data query request; acquiring a preset label; acquiring information corresponding to the preset tag from all the information to serve as the configuration condition;
and acquiring target data from the cache file according to the configuration condition.
2. The data query method of claim 1, wherein prior to determining the query frequency for each query condition, the data query method further comprises:
encrypting each inquiry condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each inquiry condition;
Inserting a monitoring code into the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is detected to be queried, determining the query frequency of the any query condition;
And storing the mapping relation of each query condition, each ciphertext and each query frequency to obtain a log table.
3. The data query method of claim 2, wherein the determining a query frequency for each query condition and selecting a target condition from the plurality of query conditions based on the query frequency comprises:
Acquiring the query frequency of each query condition from the log table;
Ordering the plurality of query conditions according to the sequence of the query frequency from big to small to obtain a target queue;
Acquiring a preset numerical value;
And acquiring the first N inquiry conditions from the target queue, wherein the value of N is the preset value as the target condition.
4. The data query method of claim 1, wherein the target data is stored in a blockchain, and after the target data is obtained from the cache file according to the configuration condition, the data query method further comprises:
determining a data format from the data query request;
detecting whether the target data is in the data format;
and when the target data is not in the data format, converting the target data into data with the data format, and updating the converted data to a blockchain.
5. A data query device, the data query device comprising:
the acquisition unit is used for acquiring preset parameters and query objects;
the determining unit is configured to determine a dimension to which the preset parameter belongs, and determine a logic instruction of the preset parameter according to the dimension, where the determining unit includes: acquiring a preset mapping relation table; acquiring dimensions corresponding to the preset parameters from the preset mapping relation table; acquiring a preset dimension table; acquiring a logic instruction corresponding to the dimension from the preset dimension table;
The splicing unit is used for splicing the preset parameters according to the logic instruction to obtain a plurality of inquiry conditions;
the determining unit is further configured to determine a query frequency of each query condition, and select a target condition from the plurality of query conditions based on the query frequency;
the query unit is configured to query the query object by using the target condition to obtain query data, and includes: acquiring query parameters in the target conditions; determining the parameter quantity of the query parameters; acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the plurality of idle threads is the same as the number of the parameters; screening the data in the query object by utilizing the plurality of idle threads based on the query parameters to obtain primary screening data; processing the preliminary screening data based on the logic instruction in the target condition to obtain the query data, and caching the mapping relation between the query data and the target condition to obtain a cache file;
The obtaining unit is further configured to obtain, when receiving a data query request, a configuration condition from the data query request, where the obtaining unit includes: acquiring a target thread from the preset thread connection pool; analyzing the method body of the data query request by using the target thread to obtain all information carried by the data query request; acquiring a preset label; acquiring information corresponding to the preset tag from all the information to serve as the configuration condition;
the obtaining unit is further configured to obtain target data from the cache file according to the configuration condition.
6. An electronic device, the electronic device comprising:
A memory storing at least one instruction; and
A processor executing instructions stored in the memory to implement the data query method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized by: the computer-readable storage medium having stored therein at least one instruction for execution by a processor in an electronic device to implement the data query method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010624353.4A CN111814045B (en) | 2020-06-30 | 2020-06-30 | Data query method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010624353.4A CN111814045B (en) | 2020-06-30 | 2020-06-30 | Data query method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111814045A CN111814045A (en) | 2020-10-23 |
CN111814045B true CN111814045B (en) | 2024-06-14 |
Family
ID=72856713
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010624353.4A Active CN111814045B (en) | 2020-06-30 | 2020-06-30 | Data query method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111814045B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527843B (en) * | 2020-12-18 | 2023-04-14 | 国家工业信息安全发展研究中心 | Data query method, device, terminal equipment and storage medium |
CN112632411A (en) * | 2020-12-24 | 2021-04-09 | 武汉旷视金智科技有限公司 | Target object data query method, device, equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104281579A (en) * | 2013-07-02 | 2015-01-14 | 腾讯科技(北京)有限公司 | Method for conducting website data querying and server |
CN107515875A (en) * | 2016-06-16 | 2017-12-26 | 阿里巴巴集团控股有限公司 | Data query method and device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104321766A (en) * | 2012-12-31 | 2015-01-28 | 华为技术有限公司 | Data processing method and device |
CN105512134A (en) * | 2014-09-25 | 2016-04-20 | 中兴通讯股份有限公司 | Method and system for querying data based on SNMP protocol |
US10275495B2 (en) * | 2015-11-24 | 2019-04-30 | Sap Se | User-dependent ranking of data items |
CN109241196A (en) * | 2017-07-06 | 2019-01-18 | 阿里巴巴集团控股有限公司 | Data query method and device, equipment |
-
2020
- 2020-06-30 CN CN202010624353.4A patent/CN111814045B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104281579A (en) * | 2013-07-02 | 2015-01-14 | 腾讯科技(北京)有限公司 | Method for conducting website data querying and server |
CN107515875A (en) * | 2016-06-16 | 2017-12-26 | 阿里巴巴集团控股有限公司 | Data query method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111814045A (en) | 2020-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111901327B (en) | Cloud network vulnerability mining method and device, electronic equipment and medium | |
CN111694840B (en) | Data synchronization method, device, server and storage medium | |
US20170126603A1 (en) | Distributing retained messages information in a clustered publish/subscribe system | |
CN111814045B (en) | Data query method, device, electronic equipment and storage medium | |
CN112541009B (en) | Data query method, device, electronic equipment and storage medium | |
CN112860737B (en) | Data query method and device, electronic equipment and readable storage medium | |
CN113050900B (en) | Screen sharing method, device, equipment and storage medium | |
CN111797351A (en) | Page data management method and device, electronic equipment and medium | |
EP3557437A1 (en) | Systems and methods for search template generation | |
CN112053143B (en) | Fund routing method, apparatus, electronic device and storage medium | |
CN111813868B (en) | Data synchronization method and device | |
CN112069384A (en) | Buried point data processing method, server and readable storage medium | |
CN111694852B (en) | Data processing method, device, terminal and storage medium based on distributed transaction | |
CN116360769A (en) | Code generation method, device, equipment and storage medium | |
CN111796936A (en) | Request processing method and device, electronic equipment and medium | |
WO2022073513A1 (en) | Information input assistance method and apparatus, electronic device and storage medium | |
CN113706249B (en) | Data recommendation method and device, electronic equipment and storage medium | |
CN109544207B (en) | Information processing method, storage medium and server | |
CN112181485B (en) | Script execution method and device, electronic equipment and storage medium | |
CN112434062A (en) | Quasi-real-time data processing method, device, server and storage medium | |
KR20110037969A (en) | Targeted user notification of messages in a monitoring system | |
CN112395319B (en) | Cache sharing method and device, server and storage medium | |
CN115002062B (en) | Message processing method, device, equipment and readable storage medium | |
CN109377391B (en) | Information tracking method, storage medium and server | |
CN112948733B (en) | Interface maintenance method, device, computing equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |