CN115905707A - Data query method and device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN115905707A
CN115905707A CN202211659631.5A CN202211659631A CN115905707A CN 115905707 A CN115905707 A CN 115905707A CN 202211659631 A CN202211659631 A CN 202211659631A CN 115905707 A CN115905707 A CN 115905707A
Authority
CN
China
Prior art keywords
data
query
stream
stored data
data stream
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
CN202211659631.5A
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.)
Shenzhen Fulin Technology Co Ltd
Original Assignee
Shenzhen Fulin Technology 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 Shenzhen Fulin Technology Co Ltd filed Critical Shenzhen Fulin Technology Co Ltd
Priority to CN202211659631.5A priority Critical patent/CN115905707A/en
Publication of CN115905707A publication Critical patent/CN115905707A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application belongs to the field of data query, and relates to a data query method, which comprises the steps of receiving a data query request, wherein the data query request carries a screening rule and a query quantity; acquiring a data stream transmitted by a database, wherein the data stream comprises at least one piece of pre-stored data transmitted by the database; judging whether prestored data in the data stream meet a screening rule or not, acquiring the prestored data meeting the screening rule as target data, and transmitting the target data to the query stream; and if the quantity of the target data in the query stream meets the query quantity, interrupting the database to transmit prestored data to the data stream, and responding to the data query request according to the query stream. The application also provides a data query device, computer equipment and storage medium The data query efficiency can be effectively improved.

Description

Data query method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data query technologies, and in particular, to a data query method and apparatus, a computer device, and a storage medium.
Background
At present, in data query, the total amount of data of a database is used as a query object, and the query is performed one by one to screen out a target object, so that if the amount of the total amount of data is large, the load of system resources (CPU and memory) is severe, which causes a problem of low data query efficiency.
Disclosure of Invention
An embodiment of the application aims to provide a data query method, a data query device, computer equipment and a storage medium, so as to solve the problem of low data query efficiency in the background art.
In order to solve the above technical problem, an embodiment of the present application provides a data query method, which adopts the following technical solutions:
receiving a data query request, wherein the data query request carries a screening rule and a query number;
acquiring a data stream transmitted by a database, wherein the data stream comprises at least one pre-stored data transmitted by the database;
judging whether the pre-stored data in the data stream meets the screening rule, if so, taking the pre-stored data meeting the screening rule as target data, and transmitting the target data to an inquiry stream;
and if the quantity of the target data in the query stream meets the query quantity, interrupting the database from transmitting the pre-stored data to the data stream, and responding to the data query request according to the query stream.
Further, the step of determining whether the pre-stored data in the data stream satisfies the screening rule includes:
extracting the pre-stored data from the data stream, and judging whether the extracted pre-stored data meets the screening rule or not;
if the extracted pre-stored data meets the screening rule, the pre-stored data meeting the screening rule is used as target data, and the target data is transmitted to a query stream;
and if the extracted pre-stored data do not meet the screening rule, removing the pre-stored data which do not meet the screening rule from the data stream.
Further, after the step of extracting the pre-stored data from the data stream, the method further includes:
comparing the extraction speed of the pre-stored data from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database;
if the extraction speed is greater than or equal to the transmission speed, re-executing the step of extracting the pre-stored data from the data stream;
and if the extraction speed is lower than the transmission speed, suspending the database from transmitting the pre-stored data to the data stream.
Further, before the step of suspending the transmission of the pre-stored data from the database to the data stream, the method further includes:
judging whether the quantity of the pre-stored data in the data stream meets a preset quantity threshold value or not;
if the number of the pre-stored data in the data stream is greater than or equal to the preset number threshold, the step of suspending the database from transmitting the pre-stored data to the data stream is executed;
and if the number of the pre-stored data in the data stream is smaller than the preset number threshold, re-executing the step of extracting the pre-stored data from the data stream.
Further, before the step of suspending the transmission of the pre-stored data from the database to the data stream, the method further includes:
calculating a speed difference value according to the extraction speed and the transmission speed;
adjusting the transmission speed according to the speed difference to obtain a new transmission speed;
and taking the new transmission speed as the transmission speed, and re-executing the step of comparing the extraction speed of the pre-stored data extracted from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database.
Further, after the step of suspending the transmission of the pre-stored data from the database to the data stream, the method further includes:
determining a shunting condition according to the number of the pre-stored data in the data stream;
shunting the data stream according to the shunting condition to obtain a plurality of sub-data streams, wherein each sub-data stream comprises at least one piece of pre-stored data;
the step of extracting the pre-stored data from the data stream comprises:
and extracting the pre-stored data from the sub-data stream.
Further, the step of determining the shunting condition according to the amount of the pre-stored data in the data stream includes:
acquiring a preset load number, and determining a shunting condition according to the number of the pre-stored data in the data stream and the preset load number, wherein the preset load number is the load number of the pre-stored data in a preset sub-data stream;
or, obtaining the number of the pre-stored data in the data stream to determine a distribution grade, and determining a distribution condition according to the distribution grade.
In order to solve the above technical problem, an embodiment of the present application further provides a data query device, which adopts the following technical solutions:
the device comprises a request receiving module, a data query module and a query module, wherein the request receiving module is used for receiving a data query request, and the data query request carries a screening rule and a query quantity;
the data flow acquisition module is used for acquiring a data flow transmitted by a database, wherein the data flow comprises at least one piece of pre-stored data transmitted by the database;
the data transmission module is used for judging whether the pre-stored data in the data stream meet the screening rule or not, if the pre-stored data meet the screening rule, the pre-stored data meeting the screening rule are used as target data, and the target data are transmitted to the query stream;
and the request response module is used for interrupting the database to transmit the pre-stored data to the data stream if the quantity of the target data in the query stream meets the query quantity, and responding to the data query request according to the query stream.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
the memory has stored therein computer readable instructions which, when executed by the processor, implement the steps of the data query method as described above. In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
the computer readable storage medium has stored thereon computer readable instructions which, when executed by a processor, implement the steps of the data query method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects: the prestored data transmitted by the database are received through the data stream, so that the prestored data of the data stream can be gradually screened according to the screening rule, serious system load caused by screening of a large amount of prestored data is avoided, and data query efficiency is improved; meanwhile, after target data formed by the pre-stored data meeting the query quantity is stored in the query stream, the database is interrupted to transmit the pre-stored data to the data stream, so that full query from the database is avoided directly, and the data query efficiency is further improved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a data query method according to the application;
FIG. 3 is a schematic diagram of one embodiment of a data query method according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a data query device according to the present application;
FIG. 5 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof in the description and claims of this application and the description of the figures above, are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is the medium used to provide communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may use terminal devices 101, 102, 103 to interact with a server 105 over a network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Mov I picture experts Group Aud I o Layer I, mpeg compression standard audio Layer 3), MP4 players (Mov I picture experts Group Aud I o Layer I V, mpeg compression standard audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the data query method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the data query apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow diagram of one embodiment of a method of data querying in accordance with the present application is shown. The data query method comprises the following steps:
step S201, receiving a data query request, where the data query request carries a screening rule and a query quantity.
In this step, the electronic device (for example, the server/terminal device shown in fig. 1) on which the data query method operates may receive the data query request through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, an UWB (ultra wideband) connection, and other wireless connection means now known or developed in the future.
The data query request can be generated by a user operating the terminal device, for example, if a data query interface is displayed on the terminal device, the user can generate the data query request by clicking a data query button on the data query interface; in addition, the data query request is automatically generated according to a call instruction, for example, a call time (for example, 12/16/2022/12/00) is preset by a user, the call instruction is generated, and the data query request is automatically generated when the call time in the call instruction is reached.
The screening rules and the query quantity are generated by the user operating the terminal equipment, and if the screening rules and the query quantity are set on the data query interface displayed on the terminal equipment, the screening rules and the query quantity are respectively generated.
Step S202, acquiring a data stream transmitted by a database, wherein the data stream comprises at least one piece of pre-stored data transmitted by the database;
in this step, a plurality of pre-stored data are pre-stored in the database, and the pre-stored data are pre-written into the database at the beginning; if the pre-stored data is a text, the user uploads the text through the terminal equipment, and then the text is written into the database.
The data stream is formed by transmitting prestored data by a database; after receiving the data query request, the database sequentially transmits the pre-stored data in the database to the data stream, that is, the database is "upstream" of the data stream and is used for providing the pre-stored data for the data stream.
The pre-stored data may be text, pictures, audio, video, web pages, etc., and is not limited herein.
Step S203, determining whether the pre-stored data in the data stream satisfies the screening rule, and if the pre-stored data satisfies the screening rule, using the pre-stored data satisfying the screening rule as target data and transmitting the target data to a query stream.
In this step, the query stream is "downstream" of the data stream for storage
And the pre-stored data of the data stream meets the target data formed after the screening rule and is used as data for responding and processing the data query request.
After the pre-stored data of the data stream meets the screening rule, the pre-stored data meeting the screening rule is determined to be data meeting the data query request, at the moment, the pre-stored data meeting the screening rule is used as target data, and the target data is transmitted to the query stream to be used as data for responding and processing the data query request.
For example, referring to fig. 3, in fig. 3, a label 30 is a screening rule, a label 31 is a data stream, a label 32 is pre-stored data, a label 33 is target data, and a label 34 is a query stream; as shown in fig. 3, the filtering rule 30 is "circular", the data stream 31 has pre-stored data 32 with various shapes such as "circular", "quadrilateral", "triangular" and "pentagonal", and if the pre-stored data 32 extracted from the data stream 31 is "circular" corresponding to the filtering rule 30, the pre-stored data 32 with "circular" is used as the target data 33 and transmitted to the query stream 34.
In some embodiments, the filtering rule includes at least one of a filtering rule, a search rule, and an authority rule. Wherein:
the filtering rule is a filtering item and is used for filtering prestored data in the data stream; the filtering items include, but are not limited to, filtering time (e.g., filtering data of 2022 years), filtering country (e.g., filtering data of china), filtering region (e.g., filtering data of guangdong province), filtering type (e.g., filtering data of text type), and the like.
For example, the filtering item is filtering time, and if pre-stored data in the data stream is created within the filtering time, it is determined that the pre-stored data satisfies filtering rules, otherwise, it is determined that the pre-stored data does not satisfy the filtering rules.
The search rule is target search information and is used for searching prestored data meeting the search items from the data stream; the target search information includes, but is not limited to, text information, image information, and the like.
Illustratively, a user inputs text information on a terminal device as a search rule, performs word segmentation processing on the text information after receiving the text information to form a search feature, and searches pre-stored data containing the search feature from a data stream as target data.
If the text information is 'Guangdong food', two search features of 'Guangdong' and 'food' are formed after word segmentation processing is carried out on the text information, if pre-stored data in the data stream comprises the two search features, the pre-stored data is judged to meet the search rules, otherwise, the pre-stored data is judged not to meet the search rules.
The authority rules are authority levels and are used for determining whether the pre-stored data users in the data stream have inquiry authority.
Illustratively, the authority levels include a level a, a level B and a level C in sequence according to the level; each pre-stored data has a grade mark for pre-storing the query authority of the data. When screening the pre-stored data in the data stream, if the authority level is B level, if the level identification of the pre-stored data which is currently screened is B level or C level, judging that the pre-stored data meets the authority rule, and if the level identification of the pre-stored data which is currently screened is A level, judging that the pre-stored data does not meet the authority rule.
Step S204, if the quantity of the target data in the query stream meets the query quantity, the database is interrupted to transmit the pre-stored data to the data stream, and the data query request is responded according to the query stream.
In this step, the query number is the number of target acquisitions; and after the target data are transmitted to the query stream, accumulating the quantity of the target data in the query stream, and judging that the quantity of the target data in the query stream meets the query quantity when the accumulated quantity of the target data in the query stream is equal to the query quantity.
The pre-stored data transmitted by the database is received through the data stream, so that the pre-stored data of the data stream can be gradually screened according to the screening rule, serious system load caused by screening of a large amount of pre-stored data is avoided, and data query efficiency is improved; meanwhile, after target data formed by the pre-stored data meeting the query quantity is stored in the query stream, the database is interrupted to transmit the pre-stored data to the data stream, so that full query from the database is avoided directly, and the data query efficiency is further improved.
In some optional embodiments, in the step S203, the step of determining whether the pre-stored data in the data stream satisfies the filtering rule includes:
extracting the pre-stored data from the data stream, and judging whether the extracted pre-stored data meets the screening rule;
if the extracted pre-stored data meets the screening rule, the pre-stored data meeting the screening rule is used as target data, and the target data is transmitted to a query stream;
and if the extracted pre-stored data does not meet the screening rule, removing the pre-stored data which does not meet the screening rule from the data stream.
In this embodiment, the extracted pre-stored data is screened according to a screening rule to determine whether the pre-stored data is pre-stored data for target query; if the pre-stored data meet the screening rule, the pre-stored data are represented as pre-stored data of target query and are transmitted to the query stream as target data for subsequent response processing of data query requests; and if the prestored data does not meet the screening rule, representing the prestored data as the prestored data which is not inquired in a target way, and directly deleting the prestored data.
In some optional embodiments, after the step of extracting the pre-stored data from the data stream, the method further includes:
comparing the extraction speed of the pre-stored data from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database;
if the extraction speed is greater than or equal to the transmission speed, re-executing the step of extracting the pre-stored data from the data stream;
and if the extraction speed is lower than the transmission speed, suspending the database from transmitting the pre-stored data to the data stream.
In this embodiment, the extraction speed is characterized as a speed of extracting pre-stored data from a data stream within a unit time; the transmission speed is characterized by the speed of the database transmitting the pre-stored data to the data stream in unit time. The unit time may be minutes, seconds, or hours, and is not particularly limited.
In practical application, the database continuously transmits the pre-stored data to the data stream, and simultaneously continuously extracts the pre-stored data from the data stream for comparison and screening with the screening rule. When the extraction speed is higher than the transmission speed, the database continuously transmits the pre-stored data to the data stream at the moment, so that excessive accumulation of the pre-stored data on the data stream cannot be caused, and the step of extracting the pre-stored data from the data stream can be executed again; when the extraction speed is less than or equal to the transmission speed, the speed of extracting the pre-stored data from the data stream is less than the speed of adding the pre-stored data to the data stream by the database, excessive accumulation of the pre-stored data on the data stream is easily caused, the occupied load of system resources is improved, the overall stability of the system is affected, and the database is suspended from transmitting the pre-stored data to the data stream.
In some optional embodiments, before the step of suspending the transmission of the pre-stored data from the database to the data stream, the method further comprises:
judging whether the quantity of the pre-stored data in the data stream meets a preset quantity threshold value or not;
if the number of the pre-stored data in the data stream is greater than or equal to the preset number threshold, the step of suspending the database from transmitting the pre-stored data to the data stream is executed;
and if the quantity of the pre-stored data in the data stream is less than the preset quantity threshold value, re-executing the step of extracting the pre-stored data from the data stream.
In this embodiment, the preset number threshold is a maximum storage amount of pre-stored data in the data stream.
If the number of the pre-stored data in the data stream is judged to be larger than or equal to the preset number threshold value, representing that more pre-stored data cannot be loaded in the current data stream, and executing the step of suspending the database to transmit the pre-stored data to the data stream, so that the phenomenon of low extraction efficiency of extracting the pre-stored data from the data stream due to the overlarge load of the data stream is avoided, and the overall operation stability of the system is ensured.
When the number of the pre-stored data in the data stream is judged to be smaller than the preset number threshold, the current data stream can be represented to load more pre-stored data, meanwhile, the extraction efficiency of the pre-stored data extracted from the data stream cannot be excessively influenced, and at the moment, the step of extracting the pre-stored data from the data stream is executed again.
Therefore, whether the quantity of the pre-stored data in the data stream meets the preset quantity threshold value or not is judged, so that whether the load of the data stream reaches the pre-stored data threshold value or not is determined, the extraction efficiency of extracting the pre-stored data from the data stream is guaranteed, meanwhile, more data are loaded on the data stream, and the stable operation of the step of screening the pre-stored data according to the screening rule is guaranteed.
In some optional embodiments, before the step of suspending the transmission of the pre-stored data from the database to the data stream, the method further includes:
calculating a speed difference value according to the extraction speed and the transmission speed;
adjusting the transmission speed according to the speed difference to obtain a new transmission speed;
and taking the new transmission speed as the transmission speed, and re-executing the step of comparing the extraction speed of the pre-stored data extracted from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database.
In the embodiment, the speed difference is obtained by calculating the difference between the extraction speed and the transmission speed, and then the transmission speed is adjusted by using the speed difference to ensure that the new transmission speed is less than or equal to the extraction speed, so that excessive accumulation of pre-stored data in the data stream due to the fact that the extraction speed is less than the transmission speed is avoided; meanwhile, the new transmission speed is used as the transmission speed, and the extraction speed and the transmission speed are compared again, so that the extraction stability of the pre-stored data of the data stream in the system is further ensured.
Illustratively, the extraction speed is 5n/m i n, the transmission speed is 7n/m i n, where n is the number of pre-stored data, and n/m i n is the number of pre-stored data transmitted per minute; the difference between the extracted speed and the transmission speed is subtracted to obtain a speed difference value of-2 n/m i n, the sum of the transmission speed 7n/m i n and the speed difference value of-2 n/m i n is calculated at the moment to obtain a new transmission speed of 5n/m i n, and the new transmission speed of 5n/m i n is used as the transmission speed of 5n/m i n.
In some optional embodiments, after the step of suspending the database from transmitting the pre-stored data to the data stream, the method further includes:
determining a shunting condition according to the number of the pre-stored data in the data stream;
shunting the data stream according to the shunting condition to obtain a plurality of sub-data streams, wherein each sub-data stream comprises at least one piece of pre-stored data;
the step of extracting the pre-stored data from the data stream comprises:
and extracting the pre-stored data from the sub-data stream.
In this embodiment, the data stream is divided into a plurality of sub-data streams according to the splitting condition, and at this time, each sub-data stream stores the pre-stored data in a quantity corresponding to the splitting condition, and each sub-data stream operates independently, so that the pre-stored quantity in the data stream with an excessive load can be quickly processed to ensure the data query rate.
In some embodiments, if the pre-stored data does not exist in the sub-data stream, it is characterized that all pre-stored data in the sub-data stream have been extracted and processed, and at this time, the sub-data stream in which the pre-stored data does not exist is deleted;
if all the sub-data streams are deleted and if the number of the target data in the query stream does not meet the query number, acquiring a new data stream transmitted by a database; taking the new data stream as the data stream, and executing the step of extracting the pre-stored data from the data stream.
In some optional embodiments, the step of determining a shunting condition according to the amount of the pre-stored data in the data stream includes:
acquiring a preset load number, and determining a shunting condition according to the number of the pre-stored data in the data stream and the preset load number, wherein the preset load number is the load number of the pre-stored data in a preset sub-data stream;
in this step, the number of the pre-stored data in the data stream can be divided according to the maximum load number of the pre-stored data in the sub-data stream to form a shunting condition; if the number of the pre-stored data in the data stream is 50 and the maximum load number of the preset sub-data stream is 10, the data stream is divided into 5 sub-data streams according to the determined splitting condition according to the number of the pre-stored data in the data stream and the maximum load number of the sub-data stream.
In some optional embodiments, the step of determining a shunting condition according to the amount of the pre-stored data in the data stream includes:
and acquiring the quantity of the pre-stored data in the data stream to determine a distribution grade, and determining a distribution condition according to the distribution grade.
In this step, the distribution level corresponding to the number of the pre-stored data in the data stream may be determined, and then the distribution condition may be determined based on the distribution level, where the distribution level is preset by a user and has multiple distribution levels, and the distribution conditions corresponding to the distribution levels of each level are different.
For example, the data stream has a grade 1 flow division level, the number of the pre-stored data in the data stream corresponding to the grade 1 flow division level is 20 to 39, and the grade 1 flow division level corresponds to the flow division condition that the data stream is divided into 2 sub-data streams; the number of pre-stored data in the data stream corresponding to the 2-level flow grade is 40 to 59, and the flow dividing condition corresponding to the 2-level flow grade is that the data stream is divided into 4 sub-data streams; the number of the data in the data stream corresponding to the 3-level flow division grade is 60 to 79, and the flow division condition corresponding to the 3-level flow division grade is that the data stream is divided into 6 sub-data streams. In practical application, if the number of the pre-stored data in the data stream is 60, the corresponding 3-level splitting level is determined, and the data stream is split into 6 sub-data streams, where each sub-data stream includes 10 pre-stored data.
It is emphasized that to further ensure the database and pre-stored data, the database and pre-stored data may also be stored in a node of a block chain.
The block chain referred by the application 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. The block chain (B l ockcha i n), which is essentially a decentralized database, is a string of data blocks associated by using cryptography, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. The artificial intelligence (Art I f I c I a l I nte l I gene, AI) is a theory, method, technique and application system for simulating, extending and expanding human intelligence by using a digital computer or a machine controlled by a digital computer, sensing environment, acquiring knowledge and obtaining the best result by using the knowledge.
The artificial intelligence base technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware that is configured to be instructed by computer-readable instructions, which can be stored in a computer-readable storage medium, and when executed, the programs may include the processes of the embodiments of the methods described above. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 4, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a data query apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied to various electronic devices.
As shown in fig. 4, the data query apparatus 400 according to this embodiment includes: a request receiving module 401, a data stream obtaining module 402, a data transmission module 403, a request response module 404 and a processing module 405. Wherein:
a request receiving module 401, configured to receive a data query request, where the data query request carries a screening rule and a query quantity;
a data stream acquiring module 402, configured to acquire a data stream transmitted by a database, where the data stream includes at least one pre-stored data transmitted by the database;
a data transmission module 403, configured to determine whether the pre-stored data in the data stream satisfies the screening rule, and if the pre-stored data satisfies the screening rule, use the pre-stored data satisfying the screening rule as target data and transmit the target data to an inquiry stream;
a request response module 404, configured to, if the number of the target data in the query stream meets the query number, interrupt transmission of the pre-stored data from the database to the data stream, and respond to the data query request according to the query stream.
The pre-stored data transmitted by the database is received through the data stream, so that the pre-stored data of the data stream can be gradually screened according to the screening rule, serious system load caused by screening of a large amount of pre-stored data is avoided, and data query efficiency is improved; meanwhile, after target data formed by pre-stored data meeting the query quantity is stored in the query stream, the database is interrupted to transmit the pre-stored data to the data stream, so that full query directly from the database is avoided, and the data query efficiency is further improved.
In some optional embodiments, the data transmission module 403 includes a data determination sub-module, an execution sub-module, and a removal sub-module. Wherein:
the data judgment sub-module is used for extracting the pre-stored data from the data stream and judging whether the extracted pre-stored data meet the screening rule or not;
an execution submodule, configured to, if the extracted pre-stored data meets the screening rule, take the pre-stored data meeting the screening rule as target data, and transmit the target data to a query stream;
and the removing submodule is used for removing the prestored data which do not meet the screening rule from the data stream if the extracted prestored data do not meet the screening rule.
In some optional embodiments, the data transmission module 403 further includes a comparison sub-module, an execution sub-module, and a pause sub-module. Wherein:
the comparison submodule is used for comparing the extraction speed of the pre-stored data extracted from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database;
an execution submodule, configured to re-execute the step of extracting the pre-stored data from the data stream if the extraction speed is greater than or equal to the transmission speed;
and the pause submodule is used for pausing the database to transmit the pre-stored data to the data stream if the extraction speed is less than the transmission speed.
In some optional embodiments, the suspend submodule includes a determining unit, a first executing unit, and a second executing unit. Wherein:
the judging unit is used for judging whether the number of the pre-stored data in the data stream meets a preset number threshold value or not;
a first execution unit, configured to, if the number of the pre-stored data in the data stream is greater than or equal to the preset number threshold, perform the step of suspending transmission of the pre-stored data from the database to the data stream;
a second execution unit, configured to re-execute the step of extracting the pre-stored data from the data stream if the number of the pre-stored data in the data stream is smaller than the preset number threshold.
In some optional embodiments, the pause sub-module further includes a calculating unit, an adjusting unit, and a third executing unit. Wherein:
a calculation unit for calculating a speed difference value from the extraction speed and the transmission speed;
the adjusting unit is used for adjusting the transmission speed according to the speed difference value to obtain a new transmission speed;
and a third execution unit, configured to re-execute the step of comparing the extraction speed of the pre-stored data extracted from the data stream with the transmission speed of the pre-stored data transmitted from the database to the data stream, with the new transmission speed as the transmission speed.
In some optional embodiments, the suspend submodule further includes a condition determining unit and a shunt processing unit. Wherein:
the condition determining unit is used for determining a shunting condition according to the number of the pre-stored data in the data stream;
the data stream is divided according to the dividing conditions to obtain a plurality of sub-data streams, wherein each sub-data stream comprises at least one piece of pre-stored data;
the data transmission module 403 further includes an extraction sub-module. Wherein:
and the extraction submodule is used for extracting the pre-stored data from the sub-data stream.
In some optional embodiments, the condition determining unit includes a first determining subunit or a second determining subunit. Wherein:
a first determining subunit, configured to obtain a preset load number, and determine a offloading condition according to the number of pre-stored data in the data stream and the preset load number, where the preset load number is a load number of the pre-stored data in a preset sub-data stream;
and the second determining subunit is configured to obtain the number of the pre-stored data in the data stream to determine a distribution level, and determine a distribution condition according to the distribution level.
In order to solve the technical problem, the embodiment of the application further provides computer equipment. Referring to fig. 5, fig. 5 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 5 comprises a memory 51, a processor 52, a network interface 53 communicatively connected to each other via a system bus. It is noted that only a computer device 5 having components 51-53 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. AS will be understood by those skilled in the art, the computer device herein is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (App I cat I on Spec I C I integrated C I rcu I, AS ic), a programmable Gate array (F I l D-programmable ab l Gate Ar ray, FPGA), a digital Processor (D I ta l S I gna l Processor, DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 51 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or a memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure digital (Secure D i g i ta l, SD) Card, a flash memory Card (F l ash Card), and the like, which are provided on the computer device 5. Of course, the memory 51 may also comprise both an internal storage unit of the computer device 5 and an external storage device thereof. In this embodiment, the memory 51 is generally used for storing an operating system installed in the computer device 5 and various application software, such as computer readable instructions of a data query method. Further, the memory 51 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 52 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 52 is typically arranged to control the overall operation of the computer device 5. In this embodiment, the processor 52 is configured to execute computer readable instructions stored in the memory 51 or process data, for example, execute computer readable instructions of the data query method.
The network interface 53 may comprise a wireless network interface or a wired network interface, and the network interface 53 is generally used for establishing a communication connection between the computer device 5 and other electronic devices.
The prestored data transmitted by the database are received through the data stream, so that the prestored data of the data stream can be gradually screened according to the screening rule, serious system load caused by screening of a large amount of prestored data is avoided, and data query efficiency is improved; meanwhile, after target data formed by the pre-stored data meeting the query quantity is stored in the query stream, the database is interrupted to transmit the pre-stored data to the data stream, so that full query from the database is avoided directly, and the data query efficiency is further improved.
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the data query method as described above. The computer readable storage medium may be a non-volatile storage medium or a volatile storage medium.
The pre-stored data transmitted by the database is received through the data stream, so that the pre-stored data of the data stream can be gradually screened according to the screening rule, serious system load caused by screening of a large amount of pre-stored data is avoided, and data query efficiency is improved; meanwhile, after target data formed by the pre-stored data meeting the query quantity is stored in the query stream, the database is interrupted to transmit the pre-stored data to the data stream, so that full query from the database is avoided directly, and the data query efficiency is further improved.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It should be understood that the above-described embodiments are merely exemplary of some, and not all, embodiments of the present application, and that the drawings illustrate preferred embodiments of the present application without limiting the scope of the claims appended hereto. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that modifications can be made to the embodiments described in the foregoing detailed description, or equivalents can be substituted for some of the features described therein. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A data query method, comprising the steps of:
receiving a data query request, wherein the data query request carries a screening rule and a query number;
obtaining a data stream transmitted by a database, wherein the data stream comprises at least one pre-stored data transmitted by the database;
judging whether the pre-stored data in the data stream meets the screening rule or not, if so, taking the pre-stored data meeting the screening rule as target data, and transmitting the target data to a query stream;
and if the quantity of the target data in the query stream meets the query quantity, interrupting the transmission of the prestored data from the database to the data stream, and responding to the data query request according to the query stream.
2. The method according to claim 1, wherein the step of determining whether the pre-stored data in the data stream satisfies the filtering rule comprises:
extracting the pre-stored data from the data stream, and judging whether the extracted pre-stored data meets the screening rule;
if the extracted pre-stored data meets the screening rule, executing the step of taking the pre-stored data meeting the screening rule as target data and transmitting the target data to a query stream;
and if the extracted pre-stored data does not meet the screening rule, removing the pre-stored data which does not meet the screening rule from the data stream.
3. The data query method of claim 2, further comprising, after the step of extracting the pre-stored data from the data stream:
comparing the extraction speed of the pre-stored data from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database;
if the extraction speed is greater than or equal to the transmission speed, re-executing the step of extracting the pre-stored data from the data stream;
and if the extraction speed is lower than the transmission speed, suspending the database from transmitting the pre-stored data to the data stream.
4. The method according to claim 3, further comprising, before the step of suspending the database from transmitting the pre-stored data to the data stream:
judging whether the quantity of the pre-stored data in the data stream meets a preset quantity threshold value or not;
if the number of the pre-stored data in the data stream is greater than or equal to the preset number threshold, the step of suspending the database from transmitting the pre-stored data to the data stream is executed;
and if the number of the pre-stored data in the data stream is smaller than the preset number threshold, re-executing the step of extracting the pre-stored data from the data stream.
5. The data query method according to claim 3 or 4, before the step of suspending the transmission of the pre-stored data from the database to the data stream, further comprising:
calculating a speed difference value according to the extraction speed and the transmission speed;
adjusting the transmission speed according to the speed difference value to obtain a new transmission speed;
and taking the new transmission speed as the transmission speed, and re-executing the step of comparing the extraction speed of the pre-stored data extracted from the data stream with the transmission speed of the pre-stored data transmitted to the data stream by the database.
6. The data query method according to claim 3 or 4, further comprising, after the step of suspending the database from transmitting the pre-stored data to the data stream:
determining a shunting condition according to the number of the pre-stored data in the data stream;
shunting the data stream according to the shunting condition to obtain a plurality of sub-data streams, wherein each sub-data stream comprises at least one piece of pre-stored data;
the step of extracting the pre-stored data from the data stream comprises:
and extracting the pre-stored data from the sub-data stream.
7. The data query method according to claim 5, wherein the step of determining a split condition according to the amount of the pre-stored data in the data stream comprises:
acquiring a preset load number, and determining a shunting condition according to the number of the pre-stored data in the data stream and the preset load number, wherein the preset load number is the load number of the pre-stored data in a preset sub-data stream;
or, obtaining the number of the pre-stored data in the data stream to determine a distribution grade, and determining a distribution condition according to the distribution grade.
8. A data query apparatus, comprising:
the device comprises a request receiving module, a data query module and a query module, wherein the request receiving module is used for receiving a data query request, and the data query request carries a screening rule and a query quantity;
the data flow acquisition module is used for acquiring a data flow transmitted by a database, wherein the data flow comprises at least one piece of pre-stored data transmitted by the database;
the data transmission module is used for judging whether the pre-stored data in the data stream meet the screening rule or not, if the pre-stored data meet the screening rule, the pre-stored data meeting the screening rule are used as target data, and the target data are transmitted to the query stream;
and the request response module is used for interrupting the database to transmit the pre-stored data to the data stream if the quantity of the target data in the query stream meets the query quantity, and responding to the data query request according to the query stream.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the data query method of any one of claims 1 to 7.
10. A computer readable storage medium, having computer readable instructions stored thereon, which when executed by a processor implement the steps of the data query method of any one of claims 1 to 7.
CN202211659631.5A 2022-12-22 2022-12-22 Data query method and device, computer equipment and storage medium Pending CN115905707A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211659631.5A CN115905707A (en) 2022-12-22 2022-12-22 Data query method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211659631.5A CN115905707A (en) 2022-12-22 2022-12-22 Data query method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115905707A true CN115905707A (en) 2023-04-04

Family

ID=86481873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211659631.5A Pending CN115905707A (en) 2022-12-22 2022-12-22 Data query method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115905707A (en)

Similar Documents

Publication Publication Date Title
CN109819284B (en) Short video recommendation method and device, computer equipment and storage medium
WO2017096987A1 (en) Message display method and terminal device
CN110929799B (en) Method, electronic device, and computer-readable medium for detecting abnormal user
CN108595448B (en) Information pushing method and device
CN113220734A (en) Course recommendation method and device, computer equipment and storage medium
CN112395390B (en) Training corpus generation method of intention recognition model and related equipment thereof
CN114154013A (en) Video recommendation method, device, equipment and storage medium
CN115941322A (en) Attack detection method, device, equipment and storage medium based on artificial intelligence
CN112966756A (en) Visual access rule generation method and device, machine readable medium and equipment
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN114221964B (en) Access request processing method, device, computer equipment and storage medium
CN112002352B (en) Random music playing method and device, computer equipment and storage medium
CN115905707A (en) Data query method and device, computer equipment and storage medium
WO2023066258A1 (en) Data processing method and apparatus for private data, computer device and medium
CN113343133B (en) Display page generation method, related device and computer program product
CN114995914A (en) Picture data processing method and device, computer equipment and storage medium
CN112887426B (en) Information stream pushing method and device, electronic equipment and storage medium
CN114186147A (en) Data processing method and device, electronic equipment and storage medium
CN110472055B (en) Method and device for marking data
WO2020078049A1 (en) User information processing method and device, server, and readable medium
CN112182107A (en) Method and device for acquiring list data, computer equipment and storage medium
CN114650252B (en) Routing method and device based on enterprise service bus and computer equipment
CN116911304B (en) Text recommendation method and device
CN110992067B (en) Message pushing method, device, computer equipment and storage medium
CN110866040B (en) User portrait generation method, device and system

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