CN111159244A - Data query method and device - Google Patents

Data query method and device Download PDF

Info

Publication number
CN111159244A
CN111159244A CN201911400068.8A CN201911400068A CN111159244A CN 111159244 A CN111159244 A CN 111159244A CN 201911400068 A CN201911400068 A CN 201911400068A CN 111159244 A CN111159244 A CN 111159244A
Authority
CN
China
Prior art keywords
data
sensor data
query request
sensor
database
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.)
Granted
Application number
CN201911400068.8A
Other languages
Chinese (zh)
Other versions
CN111159244B (en
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.)
Beijing Zhongxiaoyun Iot Institute Co ltd
Original Assignee
Beijing Zhongxiaoyun Iot Institute 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 Beijing Zhongxiaoyun Iot Institute Co ltd filed Critical Beijing Zhongxiaoyun Iot Institute Co ltd
Priority to CN201911400068.8A priority Critical patent/CN111159244B/en
Publication of CN111159244A publication Critical patent/CN111159244A/en
Application granted granted Critical
Publication of CN111159244B publication Critical patent/CN111159244B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data query method and a data query device. Wherein, the method comprises the following steps: receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; and sending the sensor data stored in the storage location to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data. The invention solves the technical problems of low query efficiency and poor universality when querying the sensor data used for drawing the sensor data curve graph in the prior art.

Description

Data query method and device
Technical Field
The invention relates to the field of data processing, in particular to a data query method and a data query device.
Background
In the prior art, when a sensor curve graph is drawn, the data of the sensor acquisition value for drawing the curve graph is separately stored according to a preset value, and is stored in MySQL when the data is lower than the preset value, and is stored in mongoDB when the data is higher than the preset value. The using scene has strong limitation, and is inconvenient to apply to a system without a preset value.
In addition, only one queue of the activeMQ is established, which cannot adapt to a complex service scene and the complex requirement that the same message needs to be processed by services of a plurality of different services, and can affect the stability of the service cluster. Finally, activeMQ can present performance issues with increasing sensor acquisition value messages.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a data query method and a data query device, which are used for at least solving the technical problems of low query efficiency and poor universality when querying sensor data used for drawing a sensor data curve graph in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a data query method, including: receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; and sending the sensor data stored in the storage location to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
Further, the sensor data includes: collecting an average value of the analog quantity; before receiving a data query request from a server, the method further includes: detecting whether an analog quantity acquisition value uploaded by a sensor is received or not; and if the analog quantity acquisition value is received, updating the first database based on the analog quantity acquisition value, recalculating the analog quantity acquisition average value in the data structure storage system, and storing the updated analog quantity acquisition average value in the data structure storage system.
Further, after storing the updated analog quantity acquisition average value in the data structure storage system, the method further includes: detecting whether a preset timing time period is finished or not, wherein timing is started after the analog quantity acquisition value is received; under the condition that the end of the timing time period is detected every time, acquiring the updated analog quantity acquisition average value stored in the timing time period by the data structure storage system; and transferring the updated analog quantity acquisition average value from the data structure storage system to a second database.
Further, the first database is a MySQL database; the data structure storage system is a Redis data structure storage system; the second database is a mongoDB database.
Further, determining the storage location of the sensor data according to the data query request includes: detecting whether the data query request is a first query request; and if the data query request is detected to be the first query request, determining that the storage position of the sensor data is the second database.
Further, after determining that the storage location of the sensor data is the second database, the method further includes: acquiring the sensor data stored in the second database; and transferring the sensor data to the data structure storage system, and setting an effective time period corresponding to the time information, wherein the sensor data stored in the data structure storage system is deleted after the effective time period is ended.
Further, if the data query request is detected to be a non-initial query request, determining that the storage location of the sensor data is the data structure storage system; and if the sensor data is not searched in the data structure storage system, determining that the storage position is the second database.
Further, the time information includes at least one of: first time information in hours, second time information in days.
According to another aspect of the embodiments of the present invention, there is also provided a data query apparatus, including: the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a data query request from a server, the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; the determining module is used for determining the storage position of the sensor data according to the data query request; and the sending module is used for sending the sensor data stored in the storage position to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, where the storage medium includes a stored program, and when the program runs, the apparatus on which the storage medium is located is controlled to execute any one of the above data query methods.
According to another aspect of the embodiments of the present invention, there is also provided a processor, where the processor is configured to execute a program, where the program executes any one of the data query methods described above.
In the embodiment of the invention, a data query request from a server is received, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; the sensor data stored in the storage location are sent to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data, and the purpose of improving the query efficiency and accuracy of querying the sensor data for drawing the sensor data curve graph is achieved, so that the technical effect of improving the processing efficiency of drawing the sensor data curve graph is achieved, and the technical problems of low query efficiency and poor universality when the sensor data for drawing the sensor data curve graph is queried in the prior art are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a data query method according to an embodiment of the invention;
FIG. 2 is a flow diagram of an alternative data query method according to an embodiment of the invention;
FIG. 3 is a flow diagram of an alternative data query method according to an embodiment of the invention;
fig. 4 is a schematic structural diagram of a data query device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, in order to facilitate understanding of the embodiments of the present invention, some terms or nouns referred to in the present invention will be explained as follows:
sensor (transducer/sensor): the device is a detection device which can sense the measured information and convert the sensed information into an electric signal or other information in a required form according to a certain rule to be output so as to meet the requirements of information transmission, processing, storage, display, recording, control and the like.
MySQL refers to a relational database management system.
The mongoDB is a NOSQL database based on distributed file storage, and has the characteristics of high performance, expandability, easiness in deployment and use, convenience in data storage and the like.
Redis: is a data structure storage system in open source (BSD licensed) memory that can be used as database, cache, and message middleware.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a data query method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be executed in an order different than that herein.
Fig. 1 is a flowchart of a data query method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data;
step S104, determining the storage position of the sensor data according to the data query request;
and step S106, sending the sensor data stored in the storage position to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
In the embodiment of the invention, a data query request from a server is received, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; the sensor data stored in the storage location are sent to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data, and the purpose of improving the query efficiency and accuracy of querying the sensor data for drawing the sensor data curve graph is achieved, so that the technical effect of improving the processing efficiency of drawing the sensor data curve graph is achieved, and the technical problems of low query efficiency and poor universality when the sensor data for drawing the sensor data curve graph is queried in the prior art are solved.
Optionally, the time information includes at least one of: first time information in hours, second time information in days. For example, the first time information may be 24 hours, and the second time information may be 30 days, and further, the embodiment of the present application may support a requirement of drawing a graph of the mass sensor in approximately 24 hours and approximately 30 days.
Optionally, the data query request is used to request to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data.
In this embodiment, a storage location of the sensor data may be determined according to the data query request, and the sensor data stored in the storage location is sent to the server, so that the server is used to draw a sensor data graph according to the sensor data.
The data storage method and the data storage device provide a whole set of calculation and cache support for querying data points in the drawing curve graph, have strong universality, can be applied to various drawing scenes comprising the collection value curve graph and the collection data average value curve graph, and can improve the stability of data storage and data processing through the scattered processing of the collection value data.
In an alternative embodiment, the sensor data comprises: collecting an average value of the analog quantity; before receiving a data query request from a server, the method further includes:
step S202, detecting whether an analog quantity acquisition value uploaded by a sensor is received;
step S204, if the analog quantity acquisition value is received, updating a first database based on the analog quantity acquisition value, recalculating an analog quantity acquisition average value in a data structure storage system, and storing the updated analog quantity acquisition average value in the data structure storage system.
In the above alternative embodiment, as shown in fig. 2, whenever it is detected that the sensor uploads an analog acquisition value to the cloud platform, the cloud platform first updates the latest analog acquisition value to the first database MySQL and updates the analog acquisition value to the original record set of the mongo db database. After the sensor finishes uploading the collection value, the collection value can be recorded in the data structure storage system Redis, the analog quantity collection average value is recalculated, the updated analog quantity collection average value (middle average value) is stored in the data structure storage system Redis, and the hour average value is stored in the hour average value set of the mongoDB database.
In an optional embodiment, after storing the updated analog quantity acquisition average value in the data structure storage system, the method further includes:
step S302, detecting whether a preset timing time period is over, wherein, timing is started after the analog quantity acquisition value is received;
step S304, under the condition that the end of the timing time period is detected each time, acquiring the updated analog quantity acquisition average value stored in the timing time period by the data structure storage system;
step S306, the updated analog quantity collection average value is transferred from the data structure storage system to a second database.
Optionally, the first database is a MySQL database; the data structure storage system is a Redis data structure storage system; the second database is a mongoDB database.
Wherein, the MySQL is a relational database management system; the mongoDB is an NOSQL database based on distributed file storage, and has the characteristics of high performance, expandability, easiness in deployment and use, convenience in data storage and the like; redis is a data structure storage system in open source (BSD licensed) memory that can be used as database, cache, and message middleware.
In the optional embodiment, after receiving the analog quantity acquisition value, starting timing, timing by using a timer to detect whether a predetermined timing period ends, optionally, the predetermined timing period may be one hour, 24 hours, and the like, and, in case that the timing period ends, acquiring the updated analog quantity acquisition average value stored in the timing period by the data structure storage system each time; it should be noted that the updated analog quantity collection average value stored by the data structure storage system in the timing period is a middle average value.
In the above optional embodiment, each time the end of the timing period is detected, the mean average value may be further unloaded from the data structure storage system to a second database for query.
As an alternative embodiment, determining the storage location of the sensor data according to the data query request includes:
step S402, detecting whether the data query request is a first query request;
step S404, if it is detected that the data query request is the first query request, determining that the storage location of the sensor data is the second database.
Optionally, in an embodiment of the present application, after determining that the storage location of the sensor data is the second database, the method further includes:
step S502, acquiring the sensor data stored in the second database;
step S504 is performed to dump the sensor data into the data structure storage system and set an effective time period corresponding to the time information, wherein the sensor data stored in the data structure storage system is deleted after the effective time period is over.
As another alternative embodiment, if it is detected that the data query request is a non-primary query request, determining that the storage location of the sensor data is the data structure storage system; and if the sensor data is not searched in the data structure storage system, determining that the storage position is the second database.
Optionally, in an embodiment of the present application, if the data query request indicates to query a sensor analog acquisition value in approximately 24 hours, and the data query request is the first query request, first query sensor data from the second database mongoDB, add the sensor data to the data structure storage system Redis according to an integer, and set an effective time of one day (i.e. 24 hours), when a subsequent data query request (a non-first query request) is received, first query the sensor data from the data structure storage system Redis, and if the data query request fails to query the sensor data in the data structure storage system, query the sensor data from the second database mongoDB is considered.
Optionally, in another embodiment of the present application, if the data query request indicates that a sensor analog acquisition value of approximately 30 days is queried, and the data query request is the first query request, an hour average value of 24 hours may be queried from the second database mongoDB on a day-by-day basis to perform an average calculation, then the average calculation result is cached in the data structure storage system Redis on a day-by-day basis, and an effective time of one month (i.e., 30 days) may be set, and when a data query request (other than the first query request) is subsequently received, the data query request may be queried from the data structure storage system Redis, and if the data query in the data structure storage system fails, the sensor data query in the second database mongoDB is considered.
As shown in fig. 3, when querying sensor data specifically, an analog quantity of days may be input as n, an iteration variable i +1 is defined, and it is determined whether i is less than n; if i < n, outputting an analog quantity average value, if i > n, detecting whether the analog quantity average value is stored in Redis, and if the analog quantity average value is detected to be stored in Redis, acquiring the analog quantity average value from the Redis as shown in FIG. 3; if not, whether the average value of the analog quantity is stored in the mongoDB is detected, if the average value of the analog quantity is stored in the mongoDB, the average value of the analog quantity is obtained from the mongoDB, if not, a value of 0 is initialized and stored in the Redis, a result set list, i + +, is added, and whether i is smaller than n is continuously judged by returning.
Through the embodiment of the application, smooth drawing of a graph of the mean value of the acquired analog quantity of the million-level sensor can be supported, and the cloud platform can calculate the mean value of the acquired analog quantity in real time and can perform other calculations and processing on the acquired analog quantity value.
For example, within one hour, the average value calculation is performed as long as the sensor data is received, and it is ensured that the average value of the acquired analog quantity in the last hour can be acquired in the first minute of the next hour. Similarly, the mean values of the collected analog values in days are also true. The embodiment of the application also fully utilizes a Redis expiration mechanism, reasonably utilizes the storage space of Redis, and only sensor data frequently accessed by a user can be added into the cache, so that Redis resources are reasonably used.
In order to ensure that the analog quantity average value calculation service does not affect other services, sensor messages should enter a rabbitmq queue firstly, the sensor messages are analyzed in a sensor message preprocessing service, then data related to the sensors are added and integrated into a complete json message, and the json message is put into a kafka queue. Different business processing services subscribe to the same sensor message topic in the kafka queue, and one background support service is implemented to draw a sensor acquisition value curve, so that normal operation of other services cannot be influenced after one service is crashed.
Example 2
According to an embodiment of the present invention, there is further provided an apparatus embodiment for implementing the data query method, and fig. 4 is a schematic structural diagram of a data query apparatus according to an embodiment of the present invention, as shown in fig. 4, the data query apparatus includes: a receiving module 40, a determining module 42 and a sending module 44, wherein:
a receiving module 40, configured to receive a data query request from a server, where the data query request is used to request to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; a determining module 42, configured to determine a storage location of the sensor data according to the data query request; a sending module 44, configured to send the sensor data stored in the storage location to the server, where the server is configured to draw a sensor data graph according to the sensor data.
It should be noted that the above modules may be implemented by software or hardware, for example, for the latter, the following may be implemented: the modules can be located in the same processor; alternatively, the modules may be located in different processors in any combination.
It should be noted here that the receiving module 40, the determining module 42 and the sending module 44 correspond to steps S102 to S106 in embodiment 1, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure in embodiment 1. It should be noted that the modules described above may be implemented in a computer terminal as part of an apparatus.
It should be noted that, reference may be made to the relevant description in embodiment 1 for alternative or preferred embodiments of this embodiment, and details are not described here again.
The data query device may further include a processor and a memory, and the receiving module 40, the determining module 42, the sending module 44, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls a corresponding program unit from the memory, wherein one or more than one kernel can be arranged. The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
According to the embodiment of the application, the embodiment of the storage medium is also provided. Optionally, in this embodiment, the storage medium includes a stored program, and the apparatus on which the storage medium is located is controlled to execute any one of the data query methods when the program runs.
Optionally, in this embodiment, the storage medium may be located in any one of a group of computer terminals in a computer network, or in any one of a group of mobile terminals, and the storage medium includes a stored program.
Optionally, the program controls the device on which the storage medium is located to perform the following functions when running: receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; and sending the sensor data stored in the storage location to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
According to the embodiment of the application, the embodiment of the processor is also provided. Optionally, in this embodiment, the processor is configured to execute a program, where the program executes any one of the data query methods.
The embodiment of the application provides equipment, the equipment comprises a processor, a memory and a program which is stored on the memory and can run on the processor, and the following steps are realized when the processor executes the program: receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; and sending the sensor data stored in the storage location to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data interrogation device: receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data; determining the storage position of the sensor data according to the data query request; and sending the sensor data stored in the storage location to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units 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, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (11)

1. A method for querying data, comprising:
receiving a data query request from a server, wherein the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data;
determining the storage position of the sensor data according to the data query request;
and sending the sensor data stored in the storage position to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
2. The method of claim 1, wherein the sensor data comprises: collecting an average value of the analog quantity; before receiving a data query request from a server, the method further comprises:
detecting whether an analog quantity acquisition value uploaded by a sensor is received or not;
and if the analog quantity acquisition value is received, updating the first database based on the analog quantity acquisition value, recalculating the analog quantity acquisition average value in the data structure storage system, and storing the updated analog quantity acquisition average value in the data structure storage system.
3. The method of claim 2, wherein after storing the updated analog quantity acquisition average to the data structure storage system, the method further comprises:
detecting whether a preset timing time period is over, wherein the timing is started after the analog quantity acquisition value is received;
under the condition that the end of the timing time period is detected every time, acquiring the updated analog quantity acquisition average value stored in the timing time period by the data structure storage system;
and unloading the updated analog quantity collection average value from the data structure storage system to a second database.
4. The method of claim 3, wherein the first database is a MySQL database; the data structure storage system is a Redis data structure storage system; the second database is a mongoDB database.
5. The method of claim 3, wherein determining the storage location of the sensor data from the data query request comprises:
detecting whether the data query request is a first query request;
and if the data query request is detected to be the first query request, determining the storage position of the sensor data to be the second database.
6. The method of claim 5, wherein after determining the location of the sensor data as the second database, the method further comprises:
acquiring the sensor data stored in the second database;
and transferring the sensor data to the data structure storage system, and setting an effective time period corresponding to the time information, wherein the sensor data stored in the data structure storage system is deleted after the effective time period is ended.
7. The method of claim 5, wherein if the data query request is detected to be a non-first query request, determining the storage location of the sensor data as the data structure storage system; and if the sensor data is unsuccessfully inquired in the data structure storage system, determining that the storage position is the second database.
8. The method according to any of claims 1 to 7, wherein the time information comprises at least one of: first time information in hours, second time information in days.
9. A data query apparatus, comprising:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a data query request from a server, the data query request is used for requesting to query sensor data acquired by a sensor, and the data query request carries time information corresponding to the sensor data;
the determining module is used for determining the storage position of the sensor data according to the data query request;
and the sending module is used for sending the sensor data stored in the storage position to the server, wherein the server is used for drawing a sensor data curve graph according to the sensor data.
10. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the data query method according to any one of claims 1 to 8.
11. A processor, configured to execute a program, wherein the program executes the data query method according to any one of claims 1 to 8.
CN201911400068.8A 2019-12-30 2019-12-30 Data query method and device Active CN111159244B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911400068.8A CN111159244B (en) 2019-12-30 2019-12-30 Data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911400068.8A CN111159244B (en) 2019-12-30 2019-12-30 Data query method and device

Publications (2)

Publication Number Publication Date
CN111159244A true CN111159244A (en) 2020-05-15
CN111159244B CN111159244B (en) 2024-02-09

Family

ID=70559317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911400068.8A Active CN111159244B (en) 2019-12-30 2019-12-30 Data query method and device

Country Status (1)

Country Link
CN (1) CN111159244B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112187881A (en) * 2020-09-10 2021-01-05 青岛海尔科技有限公司 Method and device for uploading data and environment-aware node

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107784068A (en) * 2017-09-01 2018-03-09 北京趣拿软件科技有限公司 Acquisition methods, device, storage medium, processor and the service end of data variation
CN108737473A (en) * 2017-04-20 2018-11-02 贵州白山云科技有限公司 A kind of data processing method, apparatus and system
CN110162543A (en) * 2019-05-29 2019-08-23 北京奇艺世纪科技有限公司 A kind of information query method and device
WO2019178979A1 (en) * 2018-03-21 2019-09-26 平安科技(深圳)有限公司 Method for querying report data, apparatus, storage medium and server
CN110413631A (en) * 2018-04-25 2019-11-05 中移(苏州)软件技术有限公司 A kind of data query method and device
CN110580257A (en) * 2019-09-11 2019-12-17 网易(杭州)网络有限公司 Data sharing method, server and medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108737473A (en) * 2017-04-20 2018-11-02 贵州白山云科技有限公司 A kind of data processing method, apparatus and system
CN107784068A (en) * 2017-09-01 2018-03-09 北京趣拿软件科技有限公司 Acquisition methods, device, storage medium, processor and the service end of data variation
WO2019178979A1 (en) * 2018-03-21 2019-09-26 平安科技(深圳)有限公司 Method for querying report data, apparatus, storage medium and server
CN110413631A (en) * 2018-04-25 2019-11-05 中移(苏州)软件技术有限公司 A kind of data query method and device
CN110162543A (en) * 2019-05-29 2019-08-23 北京奇艺世纪科技有限公司 A kind of information query method and device
CN110580257A (en) * 2019-09-11 2019-12-17 网易(杭州)网络有限公司 Data sharing method, server and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112187881A (en) * 2020-09-10 2021-01-05 青岛海尔科技有限公司 Method and device for uploading data and environment-aware node

Also Published As

Publication number Publication date
CN111159244B (en) 2024-02-09

Similar Documents

Publication Publication Date Title
CN107911487B (en) Information pushing method and device, server and readable storage medium
JP6442081B2 (en) Application recommendation method, server, and computer-readable medium
CN109739810B (en) File synchronization method, server, client and device with storage function
CN109582470B (en) Data processing method and data processing device
CN108063818B (en) Data downloading method, device, terminal and computer readable storage medium
CN113505272B (en) Control method and device based on behavior habit, electronic equipment and storage medium
US10938773B2 (en) Method and apparatus for synchronizing contact information and medium
CN106649645B (en) Playlist processing method and device
US20220124483A1 (en) Nomination of a primary cell phone from a pool of cell phones
CN111324576B (en) Recording data storage method and device, storage medium and terminal equipment
CN111159244B (en) Data query method and device
CN107102876B (en) Application pushing method and device
CN113468274A (en) Data storage method and device, storage medium and electronic equipment
CN107688951B (en) Information pushing method and device
CN111274104A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN110825396B (en) Exception handling method and related equipment
CN109117083B (en) Mobile terminal, built-in storage capacity detection method, and computer-readable storage medium
CN111970675A (en) Early warning method and device and storage medium
CN108629610B (en) Method and device for determining popularization information exposure
CN110754076B (en) Method and device for determining brushing amount terminal
CN108269104B (en) Media information delivery method, delivery engine server and media information delivery system
CN110968453A (en) Data storage method and device
CN116185782B (en) Service monitoring method and device for social software
CN115484496B (en) Statistical method and device for play records, storage medium and electronic equipment
CN111047229A (en) Order distribution information processing method 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
GR01 Patent grant
GR01 Patent grant