CN-117076446-B - Data storage method, data query method, computer device, and medium
Abstract
The application relates to a data storage method, a data query method, computer equipment and a medium, wherein the method comprises the steps of obtaining first data to be processed; the first data to be processed comprises a first type parameter, a first time parameter and first target data, a first data table corresponding to the first target data is determined based on the first type parameter, the difference value between every two adjacent data is used for determining whether the first target data exist in the first unit time or not, the first unit time is preset minimum statistical time, the second time is determined based on the first data to be processed, and the first data table is updated so that the difference value between the first data and the second data adjacent to the first data table in the first data table is not zero. The method and the device solve the technical problem that whether the target data exist in the target time can not be determined quickly, and achieve the technical effect that whether the target data exist in the target time can be determined quickly and efficiently.
Inventors
- DAI HANG
Assignees
- 浙江大华技术股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20230731
Claims (10)
- 1. A method of data storage, the method comprising: acquiring first data to be processed, wherein the first data to be processed comprises a first type parameter, a first time parameter and first target data; Determining a first data table corresponding to the first target data based on the first type parameter, wherein the data in the first data table are stored according to a first unit time sequence, and the difference value between every two adjacent data is used for determining whether the first target data exist in the first unit time or not; Determining a first target time based on the first time parameter, wherein the first target time is the minimum statistical time of the first target data received in a time period corresponding to the first time parameter; Updating the first data table so that the difference value between first data and second data in the first data table is not zero, wherein the first data is data corresponding to the first target time, and the second data is data adjacent to the first data; the updating the first data table includes: when the data to be processed is historical data to be processed, when the data to be processed is not received completely, sequentially updating the data corresponding to the data to be processed in the first data table, and when the data to be processed is received completely, reversely updating the data corresponding to the data to be processed in the first data table, wherein the sequentially updating is used for indicating whether first target data are received in each first unit time corresponding to the data to be processed by using different identifiers; When the data to be processed is real-time data to be processed, updating the difference between the data corresponding to the first unit time corresponding to the current time and the previous data to be non-zero when the data to be processed comprises the first target data, and updating the data corresponding to the first unit time corresponding to the current time to be equal to the previous data when the data to be processed does not comprise the first target data, wherein the first target data is the data to be stored in the data to be processed.
- 2. The data storage method of claim 1, wherein prior to determining a first data table corresponding to the first target data based on the first type parameter, the method further comprises: Determining whether the first data table exists based on the first type parameter; if the first data table exists, determining the first target time based on the first data to be processed; If the first data table does not exist, the first data table corresponding to the first type parameter is built according to the first unit time.
- 3. The data storage method of claim 2, wherein the first type of parameters include an upstream channel number, a zone ID, and a processing rule.
- 4. The data storage method according to claim 2, wherein if the first data table does not exist, constructing the first data table corresponding to the first type parameter according to the first unit time includes: the first data table corresponding to the first type parameter is newly built according to the first unit time; initializing the first data table.
- 5. A data query method for querying data stored by the data storage method according to any one of claims 1 to 4, the method comprising: the query condition acquisition step is to acquire a first query condition, wherein the first query condition comprises a second type parameter and a second time parameter, and the first query condition is used for determining second target data; The data table determining step is to determine a first data table based on the second type parameter, wherein data in the first data table is stored according to a first unit time sequence, and the difference value between every two adjacent data is used for determining whether the second target data exists in the first unit time or not; and determining the statistical data, namely determining whether first statistical data of the second target data exist in each second unit time in a time period corresponding to the second time parameter in the first data table, wherein the second unit time is the statistical unit time in the first statistical data.
- 6. The method of claim 5, wherein determining whether the first statistics of the second target data exist in each second unit time in the first data table in the period corresponding to the second time parameter includes: Acquiring third data and fourth data in each second unit time period in the first data table, and determining whether the difference between the third data and the fourth data is zero, wherein the third data is data corresponding to a first unit time in the second unit time period, and the fourth data is data corresponding to a last first unit time in the second unit time period; if the difference between the third data and the fourth data is not zero, the second target data exists in the second unit time period; If the difference between the third data and the fourth data is zero, the second target data does not exist in the second unit time period.
- 7. The data query method of claim 5, wherein the method further comprises: Modifying the first query condition into a second query condition based on the first statistical data, wherein the second query condition comprises a second type parameter and a third time parameter, and a time period corresponding to the third time parameter is contained in a time period corresponding to the second time parameter; And repeating the query condition acquisition step, the data table determination step and the statistical data determination step to determine second statistical data.
- 8. The data query method of claim 7, wherein the method further comprises: and inquiring a first database based on the second inquiry condition to acquire the second target data, wherein the first database stores the second target data.
- 9. A computer device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of claims 1 to 8.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
Description
Data storage method, data query method, computer device, and medium Technical Field The present application relates to the field of information processing technologies, and in particular, to a data storage method, a data query method, a computer device, and a medium. Background The main equipment in the security field is equipment such as front end rifle bolt, ball machine and rear end DVR, NVR, HDVR. Because of the need for multiple detection scenarios and data statistics, intelligent front-ends are of a wide variety, including but not limited to intelligent functional cameras such as people counting, regional people counting, queuing people counting, heat maps, video structuring, and the like. These cameras can count the number of persons present in the shot or in a set area or information such as video structuring. Because of cost or size limitations, cameras have limited power storage and it is difficult to store large amounts of data. The front end is typically connected through a back end device such as an NVR or platform to which the front end sends statistics for long term storage and management of the data. Taking NVR devices as an example, there are multiple GUI query pages on the device for exposing statistics. After the user sets the query conditions and queries on these pages, the device retrieves the local database and graphically displays the results. The query conditions typically require specifying a range of start and stop times for the query, with the UI interface presenting results in a time-axis order. The user typically needs to wait for the query results to come out before knowing whether there is data under the specified query conditions. If the query result is null, the query under the selected condition is invalid, wasting user time. In addition, if no data exists in a larger time period within the query time range, the occupation range of effective data on the query result graph is smaller, and the data observation is not facilitated. Aiming at the technical problem that whether target data exist in target time cannot be determined quickly in the related art, an effective solution is not proposed at present. Disclosure of Invention In view of the foregoing, it is desirable to provide a data storage method, a data query method, a computer device, and a medium that can quickly and efficiently determine whether target data exists within a target time. The application provides a data storage method, which comprises the following steps: The method comprises the steps of obtaining first data to be processed, wherein the first data to be processed comprises a first type parameter, a first time parameter and first target data, determining a first data table corresponding to the first target data based on the first type parameter, storing data in the first data table according to a first unit time sequence, determining whether the first target data exist in the first unit time or not according to a difference value between every two adjacent data, determining first target time based on the first time parameter, wherein the first target time is the minimum statistical time of the first target data received in a time period corresponding to the first time parameter, updating the first data table so that a difference value between the first data and the second data in the first data table is not zero, and the first data is the data corresponding to the first target time and the second data is the data adjacent to the first data. In some embodiments, before determining the first data table corresponding to the first target data based on the first type parameter, the method further includes determining whether the first data table exists based on the first type parameter, determining the first target time based on the first data to be processed if the first data table exists, and constructing the first data table corresponding to the first type parameter according to the first unit time if the first data table does not exist. In some of these embodiments, the first type of parameters include an upstream channel number, a zone ID, and a processing rule. In some embodiments, if the first data table does not exist, constructing the first data table corresponding to the first type parameter according to the first unit time includes newly constructing the first data table corresponding to the first type parameter according to the first unit time, and initializing the first data table. In some embodiments, the first data to be processed comprises historical data to be processed, the obtaining the first data to be processed comprises obtaining the historical data to be processed, the determining of the first target time based on the first data to be processed further comprises determining whether the historical data to be processed is received completely, wherein the historical data to be processed is data before front-end online, and if the historical data to be processed is received completely, upda