CN111814045A - Data query method and device, electronic equipment and storage medium - Google Patents

Data query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111814045A
CN111814045A CN202010624353.4A CN202010624353A CN111814045A CN 111814045 A CN111814045 A CN 111814045A CN 202010624353 A CN202010624353 A CN 202010624353A CN 111814045 A CN111814045 A CN 111814045A
Authority
CN
China
Prior art keywords
query
data
condition
target
preset
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.)
Pending
Application number
CN202010624353.4A
Other languages
Chinese (zh)
Inventor
陈晓夫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202010624353.4A priority Critical patent/CN111814045A/en
Publication of CN111814045A publication Critical patent/CN111814045A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

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 comprises the steps of obtaining a preset parameter and a query object, determining the dimension to which the preset parameter belongs, determining the logic instruction of the preset parameter according to the dimension, splicing the preset parameter according to the logic instruction to obtain a plurality of query conditions, determining the query frequency of each query condition, 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, caching the mapping relation between the query data and the target condition to obtain a cache file, obtaining configuration conditions from a data query request when the data query request is received, and obtaining the target data from the cache file according to the configuration conditions. The invention can not only improve the data query efficiency, but also avoid the phenomenon of resource waste. In addition, the invention also relates to a block chain technology, and the target data can be stored in the block chain.

Description

Data query method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data query method and apparatus, an electronic device, and a storage medium.
Background
The problem of low query efficiency exists for data query of a report system with large data volume, however, the low query efficiency can cause poor experience of a user and further cause the condition of user loss, the conventional mode utilizes multithread concurrent processing to improve the data query efficiency, and the mode can repeatedly query the same query condition in a short time, thereby causing the phenomenon of resource waste.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data query method, device, electronic device and storage medium, which can not only improve the data query efficiency, but also avoid the phenomenon of resource waste.
A data query method, the data query method comprising:
acquiring preset parameters and a query object;
determining the dimensionality of the preset parameter, and determining a logic instruction of the preset parameter according to the dimensionality;
splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 inquiry object by using the target condition to obtain inquiry data, and caching the mapping relation between the inquiry 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 determining the dimension to which the preset parameter belongs and the determining the logic instruction of the preset parameter according to the dimension includes:
acquiring a preset mapping relation table;
obtaining the dimensionality corresponding to the preset parameter 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 comprises:
encrypting each query condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each query condition;
inserting a monitoring code in the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is monitored to be queried, determining the query frequency of the any query condition;
and storing the mapping relation between 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 a query frequency of 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;
sequencing the plurality of query conditions according to the sequence of the query frequency from large to small to obtain a target queue;
acquiring a preset numerical value;
and acquiring the first N query conditions from the target queue as the target conditions, wherein the value of N is the preset value.
According to a preferred embodiment of the present invention, the querying the query object by using the target condition to obtain query data includes:
acquiring query parameters in the target condition;
determining the parameter number of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the idle threads is the same as the number of the parameters;
screening the data in the query object by using the 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 the 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 as the configuration condition.
According to a preferred embodiment of the present invention, the target data is stored in a block chain, 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 in the data format, and updating the converted data to a block chain.
A data query device, the data query device comprising:
the device comprises an acquisition unit, a query unit and a processing unit, wherein the acquisition unit is used for acquiring preset parameters and query objects;
the determining unit is used for determining the dimensionality of the preset parameter and determining the logic instruction of the preset parameter according to the dimensionality;
the splicing unit is used for splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 using 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 obtaining unit is further configured to obtain a configuration condition 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
a processor executing instructions stored in the memory to implement the data query method.
A computer-readable storage medium having stored therein at least one instruction, the at least one instruction being executable 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 splicing rule of the preset parameter can be determined conveniently, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; by determining the query frequency of each query condition and selecting a target condition from the plurality of query conditions based on the query frequency, the target condition which is possibly used by a user can be quickly and accurately determined, the query object is queried by using the target condition to obtain query data, and the mapping relation between the query data and the target condition is cached to obtain a cache file. Furthermore, when a user initiates query, the target data can be quickly acquired from the cache file, so that the data query efficiency is improved, and meanwhile, the target data can be directly acquired from the cache file when the user initiates query, and repeated query cannot be performed according to the same query conditions, so that 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 implementing the data query method according to the preferred embodiment of the invention.
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 flow chart may be changed and some steps may be omitted according to different needs.
The data query method is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware thereof includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a cloud computing (cloud computing) based cloud consisting of a large number of hosts or network servers.
The Network where 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 (VPN), and the like.
And S10, acquiring preset parameters and query objects.
In at least one embodiment of the present invention, the preset parameter may be obtained from a client connected to the electronic device, or may be obtained from a cloud.
Further, the preset parameter may be a parameter set in advance by a user, for example: the preset parameter may be a teenager group, and the preset parameter may also be life insurance and the like.
In at least one embodiment of the present invention, the query object refers to a reporting system storing data. The query object can be obtained from a terminal device set by a user.
S11, determining the dimension to which the preset parameter belongs, and determining 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: seed of risk, user, date, institution, etc.
Further, the logic instruction refers to a parameter and logic between parameters, and the logic instruction includes, but is 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 the logic instruction for determining the preset parameter according to the dimension includes:
acquiring a preset mapping relation table;
obtaining the dimensionality corresponding to the preset parameter 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 preset 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.
And the logic instruction of the preset parameter can be accurately determined through the mapping relation between the parameter and the dimension and the mapping relation between the dimension and the logic instruction.
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 determined to be generated due to the logic instructions and the preset parameters.
For example: when the logic instruction is: meanwhile, when the preset parameters are parameter A, parameter B and parameter C, the query condition is parameter A and parameter B and parameter C.
Through the implementation mode, 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 that the user performs queries using the query condition.
Further, the target condition refers to a query condition frequently queried by the user.
In at least one embodiment of the present invention, before determining the query frequency for each query condition, the data query method further comprises:
encrypting each query condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each query condition;
inserting a monitoring code in the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is monitored to be queried, determining the query frequency of the any query condition;
and storing the mapping relation between each query condition, each ciphertext and each query frequency to obtain a log table.
By encrypting the query conditions, the query conditions are prevented from being tampered, the security of the query conditions is improved, meanwhile, the encryption is performed by using a symmetric encryption algorithm, the encryption rate can be improved, whether the query conditions are queried or not can be monitored in real time through monitoring codes, and the query frequency of the query conditions can be accurately determined.
In at least one embodiment of the present invention, the electronic device determines 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;
sequencing the plurality of query conditions according to the sequence of the query frequency from large to small to obtain a target queue;
acquiring a preset numerical value;
and acquiring the first N query conditions from the target queue as the target conditions, wherein the value of N is the preset value.
The preset value can be set according to an actual application scene, and the value of the preset value is not limited by the invention.
With the above-described embodiment, the query condition that the user frequently makes a query can be determined as the target condition.
S14, the query object is queried by the target condition to obtain query data, and the mapping relation between the query data and the target condition is cached 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 cache file stores the data queried from the query object by using the target condition.
In at least one embodiment of the present invention, the querying the query object by using the target condition by the electronic device, and obtaining query data includes:
acquiring query parameters in the target condition;
determining the parameter number of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the idle threads is the same as the number of the parameters;
screening the data in the query object by using the 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.
And storing the idle threads in the preset thread connection pool.
Through follow idle thread is obtained in presetting the thread connection pool, the time that the thread took can be reduced to establish, and then improves data screening efficiency, through handling the prescreening data, can obtain accurate inquiry data.
In at least one embodiment of the present invention, after obtaining the cache file, the method further includes:
determining the grade of the cache file according to the target condition;
generating prompt information according to the cache file;
determining a sending mode of the prompt message according to the grade;
and sending the prompt message to the terminal equipment of the appointed contact person in the sending mode.
Wherein the grades include, but are not limited to: level one, level two, etc.
The transmission modes include, but are not limited to: mail mode, telephone mode, etc.
Through the implementation mode, the designated contact person can be timely notified to check and receive after the cache file is obtained, and meanwhile, the prompt information can be sent in a proper sending mode through determining the grade.
S15, when receiving the data inquiry request, obtaining the configuration condition from the data inquiry 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 may be seven morning hours per day, and the specific value of the preset time is not limited in the present invention.
In at least one embodiment of the present invention, the information carried in the data query request includes, but is not limited to: a preset tag, the configuration conditions, etc.
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 as the configuration condition.
Wherein, the preset tag refers to a predefined tag, for example: name.
Further, the target thread may be any thread that is in an idle state.
By analyzing the method body of the data query request, all information carried in the data query request can be quickly obtained, the analysis speed is increased, and the configuration condition can be accurately determined by presetting the mapping relation between the label and the configuration condition.
And S16, acquiring target data from the cache file according to the configuration condition.
It is emphasized that, to further ensure the privacy and security of the target data, the target data may also be stored in a node of a blockchain.
In at least one embodiment of the present invention, the acquiring, by the electronic device, the 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.
According to the embodiment, the target data can be directly acquired 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 block chain, 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 in the data format, and updating the converted data to a block chain.
The data format may be a text format in the form of characters or a compressed format in the form of binary data.
By the implementation mode, the data inquired by the user can be ensured to meet the requirements of the data format.
According to the technical scheme, the logic instruction of the preset parameter is determined, so that the splicing rule of the preset parameter can be determined conveniently, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; by determining the query frequency of each query condition and selecting a target condition from the plurality of query conditions based on the query frequency, the target condition which is possibly used by a user can be quickly and accurately determined, the query object is queried by using the target condition to obtain query data, and the mapping relation between the query data and the target condition is cached to obtain a cache file. Furthermore, when a user initiates query, the target data can be quickly acquired from the cache file, so that the data query efficiency is improved, and meanwhile, the target data can be directly acquired from the cache file when the user initiates query, and repeated query cannot be performed according to the same query conditions, so that the phenomenon of resource waste can be avoided.
Fig. 2 is a functional block diagram of a data query device according to a preferred embodiment of the present invention. The data query device 11 includes an acquisition unit 110, a determination unit 111, a splicing 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 that can be executed by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The obtaining unit 110 obtains preset parameters and query objects.
In at least one embodiment of the present invention, the preset parameter may be obtained from a client connected to the electronic device, or may be obtained from a cloud.
Further, the preset parameter may be a parameter set in advance by a user, for example: the preset parameter may be a teenager group, and the preset parameter may also be life insurance and the like.
In at least one embodiment of the present invention, the query object refers to a reporting system storing data. The query object can be obtained from a terminal device set by a user.
The determining unit 111 determines a dimension to which the preset parameter belongs, and determines 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: seed of risk, user, date, institution, etc.
Further, the logic instruction refers to a parameter and logic between parameters, and the logic instruction includes, but is 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;
obtaining the dimensionality corresponding to the preset parameter 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 preset 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.
And the logic instruction of the preset parameter can be accurately determined through the mapping relation between the parameter and the dimension and the mapping relation between the dimension and the logic instruction.
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 determined to be generated due to the logic instructions and the preset parameters.
For example: when the logic instruction is: meanwhile, when the preset parameters are parameter A, parameter B and parameter C, the query condition is parameter A and parameter B and parameter C.
Through the implementation mode, 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 that the user performs queries using the query condition.
Further, the target condition refers to a query condition frequently queried by the 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 by 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 relationship between each query condition, each ciphertext and each query frequency to obtain a log table.
By encrypting the query conditions, the query conditions are prevented from being tampered, the security of the query conditions is improved, meanwhile, the encryption is performed by using a symmetric encryption algorithm, the encryption rate can be improved, whether the query conditions are queried or not can be monitored in real time through monitoring codes, and 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;
sequencing the plurality of query conditions according to the sequence of the query frequency from large to small to obtain a target queue;
acquiring a preset numerical value;
and acquiring the first N query conditions from the target queue as the target conditions, wherein the value of N is the preset value.
The preset value can be set according to an actual application scene, and the value of the preset value is not limited by the invention.
With the above-described embodiment, the query condition that the user frequently makes a query 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 cache file stores the data queried from the query object by using the target condition.
In at least one embodiment of the present invention, the querying unit 113 queries the query object by using the target condition, and obtaining query data includes:
acquiring query parameters in the target condition;
determining the parameter number of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the idle threads is the same as the number of the parameters;
screening the data in the query object by using the 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.
And storing the idle threads in the preset thread connection pool.
Through follow idle thread is obtained in presetting the thread connection pool, the time that the thread took can be reduced to establish, and then improves data screening efficiency, through handling the prescreening data, can obtain accurate inquiry data.
In at least one embodiment of the present invention, after obtaining the cache file, the determining unit 111 determines the level of the cache file according to the target condition;
the generating unit 119 generates prompt information according to the cache file;
the determining unit 111 determines the sending mode of the prompt message according to the grade;
the sending unit 120 sends the prompt information to the terminal device of the designated contact in the sending manner.
Wherein the grades include, but are not limited to: level one, level two, etc.
The transmission modes include, but are not limited to: mail mode, telephone mode, etc.
Through the implementation mode, the designated contact person can be timely notified to check and receive after the cache file is obtained, and meanwhile, the prompt information can be sent in a proper sending mode through determining the grade.
When a data query request is received, the obtaining unit 110 obtains 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 may be seven morning hours per day, and the specific value of the preset time is not limited in the present invention.
In at least one embodiment of the present invention, the information carried in the data query request includes, but is not limited to: a preset tag, the configuration conditions, etc.
In at least one embodiment of the present invention, the obtaining unit 110 obtains the configuration condition from the data query request, including:
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 as the configuration condition.
Wherein, the preset tag refers to a predefined tag, for example: name.
Further, the target thread may be any thread that is in an idle state.
By analyzing the method body of the data query request, all information carried in the data query request can be quickly obtained, the analysis speed is increased, and the configuration condition can be accurately determined by presetting the mapping relation between the label and the configuration condition.
The obtaining unit 110 obtains the target data from the cache file according to the configuration condition.
It is emphasized that, to further ensure the privacy and security of the target data, the target data may also be stored in a node of a blockchain.
In at least one embodiment of the present invention, the obtaining unit 110 obtains the 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.
According to the embodiment, the target data can be directly acquired 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 block chain, and after the target data is obtained from the cache file according to the configuration condition, the determining unit 111 determines a data format from the data query request;
the detecting 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 a text format in the form of characters or a compressed format in the form of binary data.
By the implementation mode, the data inquired by the user can be ensured to meet the requirements of the data format.
According to the technical scheme, the logic instruction of the preset parameter is determined, so that the splicing rule of the preset parameter can be determined conveniently, and the preset parameter is spliced according to the logic instruction, so that the query condition with the preset parameter can be accurately generated; by determining the query frequency of each query condition and selecting a target condition from the plurality of query conditions based on the query frequency, the target condition which is possibly used by a user can be quickly and accurately determined, the query object is queried by using the target condition to obtain query data, and the mapping relation between the query data and the target condition is cached to obtain a cache file. Furthermore, when a user initiates query, the target data can be quickly acquired from the cache file, so that the data query efficiency is improved, and meanwhile, the target data can be directly acquired from the cache file when the user initiates query, and repeated query cannot be performed according to the same query conditions, so that the phenomenon of resource waste can be avoided.
Fig. 3 is a schematic structural diagram of an electronic device implementing the data query method according to the preferred embodiment of the present invention.
In one embodiment of the present 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 a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 executes an operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the above-described embodiments of the data query method, such as the steps shown in fig. 1.
Alternatively, the processor 13, when executing the computer program, implements the functions of the modules/units in the above device embodiments, for example:
acquiring preset parameters and a query object;
determining the dimensionality of the preset parameter, and determining a logic instruction of the preset parameter according to the dimensionality;
splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 inquiry object by using the target condition to obtain inquiry data, and caching the mapping relation between the inquiry 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 divided into one or more modules/units, which are stored in the memory 12 and executed by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process 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 splicing unit 112, an inquiry 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 can be used for storing the computer programs and/or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer programs and/or modules stored in the memory 12 and calling data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 12 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a 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 memory having a physical form, such as a memory stick, 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 they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Referring to fig. 1, the memory 12 in the electronic device 1 stores a plurality of instructions to implement a data query method, and the processor 13 can execute the plurality of instructions to implement:
acquiring preset parameters and a query object;
determining the dimensionality of the preset parameter, and determining a logic instruction of the preset parameter according to the dimensionality;
splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 inquiry object by using the target condition to obtain inquiry data, and caching the mapping relation between the inquiry 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 processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the instruction, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
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 obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A data query method, comprising:
acquiring preset parameters and a query object;
determining the dimensionality of the preset parameter, and determining a logic instruction of the preset parameter according to the dimensionality;
splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 inquiry object by using the target condition to obtain inquiry data, and caching the mapping relation between the inquiry 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.
2. The data query method of claim 1, wherein the logic instruction for determining the dimension to which the preset parameter belongs and determining the preset parameter according to the dimension comprises:
acquiring a preset mapping relation table;
obtaining the dimensionality corresponding to the preset parameter 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.
3. 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 query condition by adopting a symmetric encryption algorithm to obtain a ciphertext of each query condition;
inserting a monitoring code in the query object, and monitoring whether the query condition is queried or not by using the monitoring code;
when any query condition is monitored to be queried, determining the query frequency of the any query condition;
and storing the mapping relation between each query condition, each ciphertext and each query frequency to obtain a log table.
4. The data query method of claim 3, wherein said 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;
sequencing the plurality of query conditions according to the sequence of the query frequency from large to small to obtain a target queue;
acquiring a preset numerical value;
and acquiring the first N query conditions from the target queue as the target conditions, wherein the value of N is the preset value.
5. The data query method of claim 1, wherein the querying the query object using the target condition to obtain query data comprises:
acquiring query parameters in the target condition;
determining the parameter number of the query parameters;
acquiring a plurality of idle threads from a preset thread connection pool, wherein the number of the threads of the idle threads is the same as the number of the parameters;
screening the data in the query object by using the 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.
6. The data query method of claim 5, wherein the obtaining 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;
and acquiring information corresponding to the preset label from all the information as the configuration condition.
7. 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 in the data format, and updating the converted data to a block chain.
8. A data query device, comprising:
the device comprises an acquisition unit, a query unit and a processing unit, wherein the acquisition unit is used for acquiring preset parameters and query objects;
the determining unit is used for determining the dimensionality of the preset parameter and determining the logic instruction of the preset parameter according to the dimensionality;
the splicing unit is used for splicing the preset parameters according to the logic instruction to obtain a plurality of query 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 using 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 obtaining unit is further configured to obtain a configuration condition 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.
9. An electronic device, characterized in that the electronic device comprises:
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 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein at least one instruction, which is executed by a processor in an electronic device to implement the data query method of any one of claims 1 to 7.
CN202010624353.4A 2020-06-30 2020-06-30 Data query method and device, electronic equipment and storage medium Pending CN111814045A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010624353.4A CN111814045A (en) 2020-06-30 2020-06-30 Data query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010624353.4A CN111814045A (en) 2020-06-30 2020-06-30 Data query method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111814045A true CN111814045A (en) 2020-10-23

Family

ID=72856713

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010624353.4A Pending CN111814045A (en) 2020-06-30 2020-06-30 Data query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111814045A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527843A (en) * 2020-12-18 2021-03-19 国家工业信息安全发展研究中心 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
CN112784139A (en) * 2021-01-13 2021-05-11 多点(深圳)数字科技有限公司 Query method, query device, electronic equipment and computer readable medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527843A (en) * 2020-12-18 2021-03-19 国家工业信息安全发展研究中心 Data query method, device, terminal equipment and storage medium
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
CN112784139A (en) * 2021-01-13 2021-05-11 多点(深圳)数字科技有限公司 Query method, query device, electronic equipment and computer readable medium

Similar Documents

Publication Publication Date Title
CN111694840B (en) Data synchronization method, device, server and storage medium
CN111901327B (en) Cloud network vulnerability mining method and device, electronic equipment and medium
US20200050782A1 (en) Method and apparatus for operating database
CN111814045A (en) Data query method and device, electronic equipment and storage medium
CN112035258A (en) Data processing method, device, electronic equipment and medium
US20170126603A1 (en) Distributing retained messages information in a clustered publish/subscribe system
CN112163412B (en) Data verification method and device, electronic equipment and storage medium
WO2021217863A1 (en) Order identifier generation method and apparatus, server, and storage medium
CN112860737B (en) Data query method and device, electronic equipment and readable storage medium
CN112541009B (en) Data query method, device, electronic equipment and storage medium
CN112702228B (en) Service flow limit response method, device, electronic equipment and readable storage medium
CN112069384A (en) Buried point data processing method, server and readable storage medium
CN111813868B (en) Data synchronization method and device
CN112948418A (en) Dynamic query method, device, equipment and storage medium
CN111881209A (en) Data synchronization method and device for heterogeneous database, electronic equipment and medium
CN111796936A (en) Request processing method and device, electronic equipment and medium
CN110688827A (en) Data processing method and device, electronic equipment and storage medium
CN112434062A (en) Quasi-real-time data processing method, device, server and storage medium
CN112784566A (en) Document generation method, device, equipment and storage medium
CN112711398A (en) Method, device and equipment for generating buried point file and storage medium
CN110619006A (en) Statistical data management method, device, platform and storage medium based on Internet of things
CN115002062B (en) Message processing method, device, equipment and readable storage medium
CN116360769A (en) Code generation method, device, equipment and storage medium
CN113283677B (en) Index data processing method, device, equipment and storage medium
CN111933241B (en) Medical data analysis method, device, electronic equipment and storage 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