WO2012151888A1 - 一种数据查询的方法及装置 - Google Patents

一种数据查询的方法及装置 Download PDF

Info

Publication number
WO2012151888A1
WO2012151888A1 PCT/CN2011/082036 CN2011082036W WO2012151888A1 WO 2012151888 A1 WO2012151888 A1 WO 2012151888A1 CN 2011082036 W CN2011082036 W CN 2011082036W WO 2012151888 A1 WO2012151888 A1 WO 2012151888A1
Authority
WO
WIPO (PCT)
Prior art keywords
collection point
current
performance record
point identifier
performance
Prior art date
Application number
PCT/CN2011/082036
Other languages
English (en)
French (fr)
Inventor
孙鸣
邓辉
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012151888A1 publication Critical patent/WO2012151888A1/zh

Links

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

Definitions

  • the present invention relates to the field of performance data collection, and more particularly to a method and apparatus for data query in performance data collection. Background technique
  • performance data In a performance acquisition system, performance data needs to be collected periodically from multiple collection points of the device, and then the performance acquisition system stores the performance data in a persistent manner.
  • the collected performance data is an indicator for judging the operation status of the equipment operation and maintenance. Therefore, the collected performance data is often queried by various conditions for comprehensive statistics. These query conditions include the collection point identifier for uniquely identifying the collection point. Acquisition time of performance data, numerical value of performance data, etc.
  • the collection point refers to a physical entity that provides performance data collection and statistics on the device, and is a source of performance data specified by the device.
  • the performance data corresponds to a database table.
  • the query involves multi-table join query, which makes the query time-consuming.
  • the database table often includes the collection point identifier, various performance data fields, and the collection timestamp. For the same collection time, The collection timestamps of all collection points are the same. The repeated storage of the collection timestamps will cause waste of storage space.
  • the same performance data of different acquisition moments is stored in the same database table, and the performance data of different collection moments is queried. Can not be processed in parallel, reducing query efficiency. Summary of the invention
  • the main purpose of the present invention is to provide a data query method and apparatus, which reduces query time, improves query efficiency, and improves space utilization of a data acquisition system.
  • a data query method includes: the performance acquisition system acquires the performance data of the collection point at the current collection time, and saves the performance record in the performance record file corresponding to the current collection time; and queries the performance record file according to the one-time traversal algorithm, The performance record corresponding to the collection point identification set is saved.
  • the performance record file corresponding to the current collection time includes: sorting the collection point identifiers in the performance record according to the sorting strategy, and sorting each performance record according to the sorting of the collection point identifiers, and sequentially storing the performance record files in a row by row.
  • the performance record file is named according to the current collection time, and the performance record file corresponds to the acquisition time.
  • the method further includes: identifying the collection point selected by the user in the pre-stored collection point identifier to form a collection point identifier set, and collecting the collection point identifier in the collection point identifier set according to the collection point identifier Sort the sorting strategy.
  • the querying the performance record file according to the one-time traversal algorithm, and saving the performance record corresponding to the collection point identifier set includes: reading the current performance record in the performance record file, and identifying the current collection point identifier in the collection point identifier set, determining The current performance record does not reach the end of the performance record file, or the current collection point identifier does not reach the end of the collection point identifier set, and compares the collection point identifier and the current collection point identifier in the current performance record;
  • the current performance record is the same as the current collection point identifier.
  • the current performance record is the performance record to be queried, saved to the created list, and the next performance record of the current performance record is read as the current performance. Record, read the next collection point identifier of the current collection point identifier as the current collection point identifier.
  • the collection point identifier in the current performance record is smaller than the current collection point identifier, and the current performance record is read.
  • the next performance record recorded, as the current performance record, is still identified by the current collection point as the current collection point identifier;
  • the current location record is greater than the current collection point identifier.
  • the current collection point identifier is read as the current collection point identifier.
  • the current performance record is still recorded as the current performance record.
  • the device for data query includes: a performance record keeping module and a data query module; and a performance record saving module, configured to save the collected point performance data acquired at the current collection time in a performance record file corresponding to the current collection time;
  • the data query module is configured to query the performance record file of the performance record storage module according to the one-time traversal algorithm, and save the performance record corresponding to the collection point identifier set.
  • the performance record saving module is specifically configured to sort the collection point identifiers in the performance record according to the sorting strategy, store the performance records in the performance record file according to the sorting of the collection point identifiers, and perform performance records according to the current collection time.
  • the file is named, and the performance record file corresponds to the collection time.
  • the data query module further includes: a collection point identifier collection unit, configured to form a collection point identifier set according to the collection point identifier selected by the user in the pre-stored collection point identifier, and select the collection point identifier in the collection point identifier set according to the sorting strategy. Sort.
  • the data query module further includes: a query unit and a query result saving unit; the query unit is configured to read the current performance record in the performance record file, and the current collection point identifier in the collection point identifier collection unit, to determine that the current performance record is not The end of the performance record file or the current collection point identifier does not reach the end of the collection point identifier set, and further compares the collection point identifier in the current performance record with the current collection point identifier; when the two are the same, the current performance record is the performance to be queried.
  • the query result saving unit is configured to receive the performance record and save it in the created list.
  • the query unit is further configured to: when the collection point identifier in the current performance record is smaller than the current collection point identifier, read the next performance record of the current performance record, as the current performance record, still use the current collection point identifier as the current collection point. When the collection point identifier in the current performance record is greater than the current collection point identifier, the next collection point identifier of the current collection point identifier is read. As the current collection point identifier, the current performance record is still recorded as the current performance record.
  • the query is performed according to the one-time traversal algorithm, and the data to be queried does not need to be circulated, and all the queries are completed in one traversal, which greatly reduces the query time;
  • the performance data of the same collection time is saved in a performance record file, which does not need to save the acquisition time repeatedly, which improves the space utilization of the data acquisition system.
  • multiple performance record files can be queried simultaneously to achieve different acquisition times.
  • the query of performance data improves the efficiency of the query.
  • FIG. 1 is a schematic flowchart of a method for implementing data query according to the present invention
  • FIG. 2 is a schematic flowchart of a method for querying a performance record corresponding to a collection point identifier according to a one-time traversal algorithm according to the present invention
  • FIG. 3 is a schematic diagram of the composition of a device for implementing data query according to the present invention. detailed description
  • the basic idea of the present invention is: the performance acquisition system acquires the performance data of the collection point at the current collection time, and saves the performance data in the performance record file corresponding to the current collection time, and queries the performance record file according to the one-time traversal algorithm, and collects the identification point with the collection point. The corresponding performance record is saved.
  • Step 101 The performance collection system acquires performance data of the collection point at the current collection time, and sequentially saves the performance data in the performance record file corresponding to the current collection time;
  • the performance collection system periodically obtains performance data from the collection point, reads the performance data in each collection point at the current collection time, and stores the performance data as a performance record in the corresponding performance record file, and records the performance according to the collection time.
  • the file is named and saved.
  • the performance record includes the collection point identifier and various performance data on the collection point.
  • the sequence preservation includes: sorting the collection point identifiers in the performance record according to the sorting strategy, and sorting each performance record according to the collection point identifier, in the order
  • the sorting policy may be used to sort the collection point identifiers according to the geographical grouping of the device where the collection point is located, the IP address sequence of the device, or the comparison of the collection point identification string.
  • the performance record file is sorted.
  • the performance acquisition system reads the current system time when acquiring the performance data of the collection point, that is, the collection time, and the collection time is named as the corresponding File name of the performance log file, the time of collection and the file name of the performance log file
  • the performance record file with the file name 2011-3-15-12.00.dat, which stores the performance data collected at 12 o'clock on March 15, 2011.
  • Step 102 Query the performance record file according to the one-time traversal algorithm, and save the performance record corresponding to the collection point identifier set;
  • the user collects the collection point identifiers that are pre-stored by the performance collection system, and selects the collection point identifiers to be queried to form a collection point identification set.
  • the performance collection system sorts the collection point identifiers in the collection point identification set according to the sorting strategy, and the ranking strategy has the same performance.
  • the sorting strategy for collecting point IDs in the log file is the same.
  • the performance acquisition system can query multiple performance log files at the same time. Performance Acquisition The system creates a list of performance records that are queried.
  • Step 1021 The performance collection system reads the current performance record in the performance record file, and simultaneously Reading the current collection point identifier in the collection point identifier set;
  • the reading is specifically as follows: The performance collecting system points to the current performance record in the performance record file through the pointer A, starting from the first line performance record, reading the performance record of the location of the pointer A; pointing the pointer B to the collection point identification set The current collection point identifier starts with the first collection point identifier and reads the collection point identifier of the location where the pointer B is located.
  • Step 1022 Determine whether the current performance record reaches the end of the performance record file or whether the current collection point identifier reaches the end of the collection point identifier set. If yes, go to step 1027; otherwise, go to step 1023.
  • the judgment is: if the content of the location of the pointer A or the pointer B is empty, the current performance record of the location where the pointer is read reaches the end of the performance record file, or the current collection point identifier reaches the end of the collection point identification set; otherwise, The current performance record does not reach the end of the performance record file, and the current collection point identifier does not reach the end of the collection point identification set.
  • Step 1023 Compare the collection point identifier in the current performance record with the current collection point identifier. If the two are the same, go to step 1024. If the collection point identifier in the current performance record is smaller than the current collection point identifier, go to step 1025. If the current performance record The collection point identifier is greater than the current collection point identifier, and the collection point identifier in the performance record is gradually increased, indicating that there is no matching performance record in the performance record file, and step 1026 is performed;
  • Step 1024 The current performance record is a performance record to be queried, and the current performance record is saved in the list.
  • the next performance record of the current performance record is read as the current performance record.
  • the next collection point identifier of the current collection point identifier is the current collection point identifier, that is, the pointer A and the pointer B are incremented by one, and the performance of the position of the pointer A is read.
  • the current performance record is recorded, and the location of the location where the pointer B is located is identified as the current collection point identifier, and step 1022 is performed;
  • Step 1025 Read the next performance record of the current performance record as the current performance record, specifically: add 1 to the pointer A, and then read the performance record of the location where the pointer A is located, and then execute Step 1022;
  • Step 1026 Read the next collection point identifier of the current collection point identifier in the collection point identifier, as the current collection point identifier, specifically: adding 1 to the pointer B, and reading the collection point identifier of the location where the pointer B is located; performing step 1022 .
  • Step 1027 the process ends.
  • the performance record corresponding to the query collection point identifier set is described in detail by using a specific embodiment. Assume that the collection point in the performance record is identified as entryid—n, where n is a positive integer, ranging from 1 to 10000.
  • the performance record is sorted according to the collection point identifier, and the sorting strategy is sorted in ascending order of n, that is, performance record. According to the ascending order of the collection point identifiers it contains, the performance record containing the collection point identifier entryid-1 is ranked in the first line of the performance record file, and the performance record containing the collection point identifier entryid-2 is ranked in the second line of the performance record file. , And so on.
  • the collection point identifier in the collection point identifier set is entryid_m, where m is a multiple of 4, and the collection point identifiers in the collection point identification set are also sorted in ascending order of m, that is, the collection point identifier entryid-4 is ranked at the collection point.
  • the first one of the identification set, the collection point identifies the entryid—the second row in the collection point identification set, and so on.
  • the performance record in the first row is used as the current performance record
  • the first collection point identifier in the collection point identifier set is used as the current collection point identifier, and the current performance record is determined not to be at the end of the performance record file, and the current collection is performed.
  • the point identifier is not at the end of the collection point identifier set, and compares the collection point identifier in the current performance record with the current collection point identifier.
  • the current performance record collection point identifier entryid-1 is smaller than the current collection point identifier entryid-4, and the current performance record is read.
  • the next performance record, as the current performance record, continue to query, and so on, until the performance record containing the collection point identifier entryid-4 is read as the current performance record, the current performance record collection point identifier entryid-4 and the current collection point identifier entryid – 4 is the same, the current performance record is the performance record to be queried, and the current performance record is saved to the created list.
  • next performance record of the current performance record is read, that is, the performance record including the collection point identifier entryid-5 is the current performance record
  • the next collection point identifier of the current collection point identifier is read, that is, The collection point identifier entryid-8 is the current collection point identifier and continues to be queried.
  • the present invention also provides a device for data query, the device is located in a performance collection system, as shown in FIG. 3, the device includes: a performance record keeping module 301, a data query module 302, and a performance record saving module 301 for The performance data of the collection point acquired at the time of collection is stored in the performance record file corresponding to the current collection time as the performance record sequence.
  • the data query module 302 is configured to query the performance record file of the performance record storage module 301 according to the one-time traversal algorithm. The performance record corresponding to the collection point identification set is saved and saved.
  • the performance record holding module 301 is specifically configured to: sort the collection point identifiers in the performance record according to the sorting strategy, and save the performance records in the performance record file according to the sorting of the collection point identifiers, and perform performance record files according to the collection time. Name and save, so that the performance record file corresponds to the acquisition time.
  • the data query module 302 further includes: a collection point identifier collection unit 3021;
  • the collection point identifier collection unit 3021 is configured to form a collection point identifier set according to the collection point identifier selected by the user in the pre-stored collection point identifier, and sort the collection point identifiers in the collection point identifier set according to the sorting strategy.
  • the data query module 302 further includes: a query unit 3022 and a query result saving unit 3023;
  • the query unit 3022 is configured to read the current performance record in the performance record file in the performance record holding module 301, and the current collection point identifier in the collection point identifier collection unit 3021, and determine that the current performance record does not reach the end of the performance record file or the current The collection point identifier does not reach the end of the collection point identifier set, and further compares the collection point identifier in the current performance record with the current collection point identifier. If the two are the same, the current performance record is the performance record to be queried, and is sent to the query result.
  • the saving unit 3023 then reads the next performance record of the current performance record as the current performance record, and reads the next collection point identifier of the current collection point identifier as the current collection point identifier, and the subsequent processing manner is the same as the previous current performance record.
  • the processing party with the current collection point identifier Same formula;
  • the query result saving unit 3023 is configured to save the received performance record into the created list.
  • the query unit 3022 is further configured to: the current point of the current performance record is smaller than the current collection point identifier, and the current performance record is read as the current performance record, and the current collection point identifier is still the current collection point identifier.
  • the subsequent processing is the same as the previous current performance record and the current collection point identifier.
  • the query unit 3022 is further configured to: the current location record identifier is greater than the current collection point identifier, and the current collection point identifier is used as the current collection point identifier, and the current performance record is still the current performance.
  • the record is processed in the same way as the previous current performance record and the current collection point identifier.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

一种数据查询的方法及装置 技术领域
本发明涉及性能数据采集领域, 特别是指性能数据采集中一种数据查 询的方法及装置。 背景技术
在性能采集系统中, 需要周期性地从设备的多个采集点采集性能数据, 然后性能采集系统会将这些性能数据以某种持久化的方式存储。 采集的性 能数据是对设备运维的运行状态进行评判的指标, 因此, 采集的性能数据 经常被以各种条件查询后进行综合统计, 这些查询条件包括用于唯一标识 采集点的采集点标识、 性能数据的采集时间、 性能数据的数值等。 其中, 所述采集点是指设备上提供性能数据采集和统计的物理实体, 是设备指定 的获取性能数据的来源。
当涉及到较大规模的采集时, 往往会产生海量的性能数据。 传统的存 储方式和存储内容组织, 例如采用关系数据库存储海量性能数据时, 对性 能数据的搜索、 查询需要针对每条要查询的信息对海量性能数据循环遍历; 并且, 关系数据库的存储方式是一个性能数据对应一个数据库表格, 查询 时涉及到多表格联合查询, 导致查询比较耗时; 另外, 数据库表中往往都 包含采集点标识、 各项性能数据字段以及采集时间戳, 对同一采集时刻来 说, 所有采集点采集时间戳都是一样的, 对采集时间戳的重复存储会造成 存储空间的浪费; 而且不同采集时刻的同一性能数据存放在同一张数据库 表格中, 对不同采集时刻的性能数据查询不能并行处理, 降低了查询效率。 发明内容
有鉴于此, 本发明的主要目的在于提供一种数据查询的方法及装置, 减少查询时间, 提高查询效率, 提高了数据采集系统的空间利用率。
为达到上述目的, 本发明的技术方案是这样实现的:
一种数据查询的方法, 包括: 性能采集系统获取当前采集时刻的采集 点性能数据, 作为性能记录顺序保存在与当前采集时刻对应的性能记录文 件中; 根据一次性遍历算法查询性能记录文件, 将与采集点标识集合对应 的性能记录进行保存。
所述顺序保存在与当前采集时刻对应的性能记录文件包括: 对性能记 录中的采集点标识按照排序策略进行排序, 将每条性能记录按照采集点标 识的排序, 顺序逐行保存在性能记录文件中, 并根据当前采集时刻对性能 记录文件进行命名, 性能记录文件与采集时刻——对应。
所述根据一次性遍历算法查询性能记录文件之前, 该方法进一步包括: 将用户在预存的采集点标识中选取的采集点标识, 组成采集点标识集合, 将采集点标识集合中的采集点标识按照排序策略进行排序。
所述根据一次性遍历算法查询性能记录文件, 将与采集点标识集合对 应的性能记录进行保存包括: 读取性能记录文件中的当前性能记录, 以及 采集点标识集合中的当前采集点标识, 确定当前性能记录没有到达性能记 录文件的末尾, 或当前采集点标识没有到达采集点标识集合的末尾, 比较 当前性能记录中的采集点标识与当前采集点标识;
当前性能记录中的采集点标识与当前采集点标识相同, 则所述当前性 能记录为要查询的性能记录, 保存到创建的列表中, 同时读取当前性能记 录的下一性能记录, 作为当前性能记录, 读取当前采集点标识的下一采集 点标识, 作为当前采集点标识。
当前性能记录中的采集点标识小于当前采集点标识, 读取当前性能记 录的下一性能记录, 作为当前性能记录, 仍以当前采集点标识为当前采集 点标识;
当前性能记录中的采集点标识大于当前采集点标识, 读取当前采集点 标识的下一采集点标识, 作为当前采集点标识, 仍以当前性能记录为当前 性能记录。
一种数据查询的装置, 包括: 性能记录保存模块、 数据查询模块; 性能记录保存模块, 用于将当前采集时刻获取的采集点性能数据, 顺 序保存在与当前采集时刻对应的性能记录文件中;
数据查询模块, 用于根据一次性遍历算法查询性能记录保存模块的性 能记录文件, 将与采集点标识集合对应的性能记录进行保存。
所述性能记录保存模块, 具体用于对性能记录中的采集点标识按照排 序策略进行排序, 将性能记录根据采集点标识的排序, 顺序保存在性能记 录文件中, 并根据当前采集时刻对性能记录文件进行命名, 性能记录文件 与采集时刻——对应。
所述数据查询模块进一步包括: 采集点标识集合单元, 用于根据用户 在预存的采集点标识中选取的采集点标识, 组成采集点标识集合, 将采集 点标识集合中的采集点标识按照排序策略进行排序。
所述数据查询模块进一步包括: 查询单元和查询结果保存单元; 查询单元, 用于读取性能记录文件中的当前性能记录, 以及采集点标 识集合单元中的当前采集点标识, 确定当前性能记录没有到达性能记录文 件末尾或当前采集点标识没有达到采集点标识集合末尾, 进一步比较当前 性能记录中的采集点标识与当前采集点标识; 当两者相同, 则所述当前性 能记录为要查询的性能记录, 发送给查询结果保存单元, 然后读取当前性 能记录的下一性能记录, 作为当前性能记录, 读取当前采集点标识的下一 采集点标识, 作为当前采集点标识; 相应的, 所述查询结果保存单元, 用于接收性能记录, 保存在创建的 列表中。
所述查询单元, 进一步用于在当前性能记录中的采集点标识小于当前 采集点标识时, 读取当前性能记录的下一性能记录, 作为当前性能记录, 仍以当前采集点标识为当前采集点标识; 在当前性能记录中的采集点标识 大于当前采集点标识时, 读取当前采集点标识的下一采集点标识, 作为当 前采集点标识, 仍以当前性能记录为当前性能记录。
由此可见, 采用本发明所述的方法及装置, 根据一次性遍历算法进行 查询, 不需要对要查询的数据进行循环遍历, 所有查询在一次遍历中完成, 极大地减少了查询时间; 同时, 同一采集时刻的性能数据保存在一个性能 记录文件中, 不需要重复保存采集时间, 提高了数据采集系统的空间利用 率; 另外, 可以同时对多个性能记录文件进行查询, 实现对不同采集时刻 的性能数据的查询, 提高了查询效率。 附图说明
图 1为本发明实现数据查询的方法流程示意图;
图 2 为本发明实现根据一次性遍历算法, 查询采集点标识对应的性能 记录的方法流程示意图;
图 3为本发明实现数据查询的装置组成示意图。 具体实施方式
本发明的基本思想是: 性能采集系统获取当前采集时刻的采集点性能 数据, 顺序保存在与当前采集时刻对应的性能记录文件中, 根据一次性遍 历算法查询性能记录文件, 将与采集点标识集合对应的性能记录进行保存。
下面通过具体实施例与附图来对本发明进行详细说明。
一种数据查询的方法, 如图 1所示, 具体步驟如下: 步驟 101、性能采集系统获取当前采集时刻的采集点的性能数据, 顺序 保存在与当前采集时刻对应的性能记录文件中;
性能采集系统周期性地从采集点上获取性能数据, 读取当前采集时刻 各采集点中的性能数据, 将性能数据作为性能记录, 顺序保存在对应的性 能记录文件中, 根据采集时刻对性能记录文件命名并保存。 所述性能记录 包括采集点标识以及采集点上的各项性能数据; 所述顺序保存包括: 对性 能记录中采集点标识按照排序策略进行排序, 将每条性能记录按照采集点 标识的排序, 顺序逐行保存在性能记录文件中; 所述排序策略可以根据采 集点所在设备的地域分组、 设备的 IP地址的顺序或者采集点标识字符串比 较等方式对采集点标识进行排序; 所述性能记录文件与采集时刻——对应, 一个采集时刻对应一个性能记录文件, 具体实现可以为: 性能采集系统读 取当前获取采集点性能数据时的系统时间, 即为采集时刻, 将采集时刻命 名为所对应的性能记录文件的文件名, 采集时刻与性能记录文件的文件名
——对应, 例如文件名为 2011-3-15-12.00.dat 的性能记录文件, 则保存了 2011年 3月 15 日 12点所采集的性能数据。
步驟 102、根据一次性遍历算法查询性能记录文件, 将与采集点标识集 合对应的性能记录进行保存;
用户通过性能采集系统预存的采集点标识, 选取要查询的采集点标识, 形成采集点标识集合; 性能采集系统将采集点标识集合中的采集点标识按 照排序策略进行排序, 所述排序策略同性能记录文件中采集点标识的排序 策略相同。 这里, 性能采集系统可同时查询多个性能记录文件。 性能采集 系统创建一个列表, 用于保存查询到的性能记录。
如图 2所示, 根据一次性遍历算法查询性能记录文件中, 查询采集点 标识集合对应的性能记录的具体步驟如下:
步驟 1021、 性能采集系统读取性能记录文件中的当前性能记录, 同时 读取采集点标识集合中的当前采集点标识;
所述读取具体为: 性能采集系统通过指针 A指向性能记录文件中的当 前性能记录, 起始为首行性能记录, 读取指针 A所在位置的性能记录; 通 过指针 B指向采集点标识集合中的当前采集点标识, 起始为第一个采集点 标识, 读取指针 B所在位置的采集点标识。
步驟 1022、 判断当前性能记录是否到达性能记录文件末尾或者当前采 集点标识是否到达采集点标识集合末尾, 如果是, 执行步驟 1027; 否则, 执行步驟 1023 ;
所述判断为: 指针 A或指针 B所在位置的内容为空, 则读取的指针所 在位置的当前性能记录到达性能记录文件的末尾, 或当前采集点标识到达 采集点标识集合的末尾; 否则, 当前性能记录没有到达性能记录文件的末 尾, 当前采集点标识没有到达采集点标识集合的末尾。
步驟 1023、 比较当前性能记录中的采集点标识与当前采集点标识, 若 两者相同, 执行步驟 1024; 若当前性能记录中的采集点标识小于当前采集 点标识, 执行步驟 1025; 若当前性能记录中的采集点标识大于当前采集点 标识, 之后的性能记录中的采集点标识会逐渐增大, 说明性能记录文件中 已没有匹配的性能记录, 执行步驟 1026;
步驟 1024、 所述当前性能记录即为要查询的性能记录, 将所述当前性 能记录保存到列表中。
读取当前性能记录的下一性能记录为当前性能记录, 当前采集点标识 的下一采集点标识为当前采集点标识, 也就是将指针 A及指针 B加 1 , 读 取指针 A所在位置的性能记录为当前性能记录, 读取指针 B所在位置的采 集点标识为当前采集点标识, 执行步驟 1022;
步驟 1025、 读取当前性能记录的下一性能记录, 作为当前性能记录, 具体为: 将指针 A加 1 , 然后读取指针 A所在位置的性能记录, 然后执行 步驟 1022;
步驟 1026、 读取采集点标识中, 当前采集点标识的下一采集点标识, 作为当前采集点标识, 具体为: 将指针 B加 1 , 读取指针 B所在位置的采 集点标识; 执行步驟 1022。
步驟 1027、 流程结束。
下面通过一个具体实施例来对查询采集点标识集合对应的性能记录进 行详细说明。假设性能记录中的采集点标识为 entryid— n, n为正整数, 取值 范围为 1至 10000,对性能记录按照采集点标识的排序,排序策略为 n的升 序排序, 也就是说, 性能记录按照其包含的采集点标识的升序排序, 即包 含采集点标识 entryid— 1的性能记录排在性能记录文件的首行, 包含采集点 标识 entryid— 2的性能记录排在性能记录文件的第二行, 依次类推。 假设采 集点标识集合中的采集点标识为 entryid— m, 其中 m为 4的倍数, 同样将采 集点标识集合中的采集点标识按照 m的升序排序, 即采集点标识 entryid— 4 排在采集点标识集合的第一个, 采集点标识 entryid— 8排在采集点标识集合 的第二个, 依次类推。 然后, 起始以首行中的性能记录作为当前性能记录, 起始以采集点标识集合中的第一个采集点标识作为当前采集点标识, 确定 当前性能记录不在性能记录文件的末尾, 当前采集点标识不在采集点标识 集合的末尾, 比较当前性能记录中的采集点标识与当前采集点标识, 当前 性能记录的采集点标识 entryid— 1小于当前采集点标识 entryid— 4 , 读取当前 性能记录的下一性能记录, 作为当前性能记录, 继续查询, 依次类推, 直 至读取包含采集点标识 entryid— 4的性能记录为当前性能记录, 当前性能记 录的采集点标识 entryid— 4与当前采集点标识 entryid— 4相同,则当前性能记 录为要查询的性能记录, 将所述当前性能记录保存到创建的列表中。 同时 读取当前性能记录的下一性能记录, 也就是包含采集点标识 entryid— 5的性 能记录为当前性能记录, 读取当前采集点标识的下一采集点标识, 也就是 采集点标识 entryid— 8为当前采集点标识, 继续查询。
本发明还提供了一种数据查询的装置, 该装置位于性能采集系统, 如 图 3所示, 该装置包括: 性能记录保存模块 301、 数据查询模块 302; 性能记录保存模块 301 , 用于将当前采集时刻获取的采集点的性能数 据, 作为性能记录顺序保存在与当前采集时刻对应的性能记录文件中; 数据查询模块 302 , 用于根据一次性遍历算法查询性能记录保存模块 301的性能记录文件中与采集点标识集合对应的性能记录并保存。
所述性能记录保存模块 301 具体用于, 对性能记录中的采集点标识按 照排序策略进行排序, 将性能记录根据采集点标识的排序, 顺序保存在性 能记录文件中, 根据采集时刻对性能记录文件命名并保存, 使性能记录文 件与采集时刻——对应。
所述数据查询模块 302进一步包括: 采集点标识集合单元 3021 ;
采集点标识集合单元 3021 , 用于根据用户在预存的采集点标识中选取 的采集点标识, 组成采集点标识集合, 将采集点标识集合中的采集点标识 按照排序策略进行排序。
所述数据查询模块 302进一步包括: 查询单元 3022和查询结果保存单 元 3023;
查询单元 3022, 用于读取性能记录保存模块 301中的性能记录文件中 的当前性能记录, 以及采集点标识集合单元 3021中的当前采集点标识, 确 定当前性能记录没有达到性能记录文件末尾或当前采集点标识没有达到采 集点标识集合末尾, 进一步比较当前性能记录中的采集点标识与当前采集 点标识, 若两者相同, 则所述当前性能记录即为要查询的性能记录, 发送 给查询结果保存单元 3023; 然后读取当前性能记录的下一性能记录, 作为 当前性能记录, 读取当前采集点标识的下一采集点标识, 作为当前采集点 标识, 之后的处理方式同之前的当前性能记录与当前采集点标识的处理方 式相同;
相应的, 查询结果保存单元 3023 , 用于将接收的性能记录保存到创建 的列表中。
所述查询单元 3022进一步用于, 当前性能记录中的采集点标识小于当 前采集点标识, 读取当前性能记录的下一性能记录, 作为当前性能记录, 仍以当前采集点标识为当前采集点标识, 之后的处理方式同之前的当前性 能记录与当前采集点标识的处理方式相同。
所述查询单元 3022进一步用于, 当前性能记录中的采集点标识大于当 前采集点标识, 读取当前采集点标识的下一采集点标识, 作为当前采集点 标识, 仍以当前性能记录为当前性能记录, 之后的处理方式同之前的当前 性能记录与当前采集点标识的处理方式相同。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。

Claims

1、 一种数据查询的方法, 其特征在于, 所述方法包括:
性能采集系统获取当前采集时刻的采集点性能数据, 作为性能记录顺 序保存在与当前采集时刻对应的性能记录文件中; 根据一次性遍历算法查 询性能记录文件, 将与采集点标识集合对应的性能记录进行保存。
2、 根据权利要求 1所述的方法, 其特征在于, 所述顺序保存在与当前 采集时刻对应的性能记录文件包括:
对性能记录中的采集点标识按照排序策略进行排序, 将每条性能记录 按照采集点标识的排序, 顺序逐行保存在性能记录文件中, 并根据当前采 集时刻对性能记录文件进行命名, 性能记录文件与采集时刻——对应。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述根据一次性遍 历算法查询性能记录文件之前, 所述方法进一步包括:
将用户在预存的采集点标识中选取的采集点标识, 组成采集点标识集 合, 将采集点标识集合中的采集点标识按照排序策略进行排序。
4、 根据权利要求 3所述的方法, 其特征在于, 所述根据一次性遍历算 法查询性能记录文件, 将与采集点标识集合对应的性能记录进行保存包括: 读取性能记录文件中的当前性能记录, 以及采集点标识集合中的当前 采集点标识, 确定当前性能记录没有到达性能记录文件的末尾, 或当前采 集点标识没有到达采集点标识集合的末尾, 比较当前性能记录中的采集点 标识与当前采集点标识;
当前性能记录中的采集点标识与当前采集点标识相同, 则所述当前性 能记录为要查询的性能记录, 保存到创建的列表中, 同时读取当前性能记 录的下一性能记录, 作为当前性能记录, 读取当前采集点标识的下一采集 点标识, 作为当前采集点标识。
5、 根据权利要求 4所述的方法, 其特征在于, 所述方法还包括: 当前性能记录中的采集点标识小于当前采集点标识, 读取当前性能记 录的下一性能记录, 作为当前性能记录, 仍以当前采集点标识为当前采集 点标识;
当前性能记录中的采集点标识大于当前采集点标识, 读取当前采集点 标识的下一采集点标识, 作为当前采集点标识, 仍以当前性能记录为当前 性能记录。
6、 一种数据查询的装置, 其特征在于, 所述装置包括: 性能记录保存 模块、 数据查询模块; 其中,
性能记录保存模块, 用于将当前采集时刻获取的采集点性能数据, 顺 序保存在与当前采集时刻对应的性能记录文件中;
数据查询模块, 用于根据一次性遍历算法查询性能记录保存模块的性 能记录文件, 将与采集点标识集合对应的性能记录进行保存。
7、 根据权利要求 6所述的装置, 其特征在于,
所述性能记录保存模块, 具体用于对性能记录中的采集点标识按照排 序策略进行排序, 将性能记录根据采集点标识的排序, 顺序保存在性能记 录文件中, 并根据当前采集时刻对性能记录文件进行命名, 性能记录文件 与采集时刻——对应。
8、 根据权利要求 6或 7所述的装置, 其特征在于, 所述数据查询模块 进一步包括: 采集点标识集合单元, 用于根据用户在预存的采集点标识中 选取的采集点标识, 组成采集点标识集合, 将采集点标识集合中的采集点 标识按照排序策略进行排序。
9、 根据权利要求 8所述的装置, 其特征在于, 所述数据查询模块进一 步包括: 查询单元和查询结果保存单元; 其中,
查询单元, 用于读取性能记录文件中的当前性能记录, 以及采集点标 识集合单元中的当前采集点标识, 确定当前性能记录没有到达性能记录文 件末尾或当前采集点标识没有达到采集点标识集合末尾, 进一步比较当前 性能记录中的采集点标识与当前采集点标识; 当两者相同, 则所述当前性 能记录为要查询的性能记录, 发送给查询结果保存单元, 然后读取当前性 能记录的下一性能记录, 作为当前性能记录, 读取当前采集点标识的下一 采集点标识, 作为当前采集点标识;
相应的, 所述查询结果保存单元, 用于接收性能记录, 保存在创建的 列表中。
10、 根据权利要求 9所述的装置, 其特征在于,
所述查询单元, 进一步用于在当前性能记录中的采集点标识小于当前 采集点标识时, 读取当前性能记录的下一性能记录, 作为当前性能记录, 仍以当前采集点标识为当前采集点标识; 在当前性能记录中的采集点标识 大于当前采集点标识时, 读取当前采集点标识的下一采集点标识, 作为当 前采集点标识, 仍以当前性能记录为当前性能记录。
PCT/CN2011/082036 2011-07-20 2011-11-10 一种数据查询的方法及装置 WO2012151888A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110204031.5 2011-07-20
CN201110204031.5A CN102236718B (zh) 2011-07-20 2011-07-20 一种数据查询的方法及装置

Publications (1)

Publication Number Publication Date
WO2012151888A1 true WO2012151888A1 (zh) 2012-11-15

Family

ID=44887364

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/082036 WO2012151888A1 (zh) 2011-07-20 2011-11-10 一种数据查询的方法及装置

Country Status (2)

Country Link
CN (1) CN102236718B (zh)
WO (1) WO2012151888A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102236718B (zh) * 2011-07-20 2019-09-13 南京中兴新软件有限责任公司 一种数据查询的方法及装置
CN108924002B (zh) * 2018-06-27 2021-10-15 郑州云海信息技术有限公司 一种性能数据文件的解析方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127048A (zh) * 2007-08-20 2008-02-20 华为技术有限公司 一种查询结果处理方法与装置
CN101247271A (zh) * 2008-03-24 2008-08-20 中兴通讯股份有限公司 性能数据的存储方法和装置
EP2237144A1 (en) * 2009-03-31 2010-10-06 BRITISH TELECOMMUNICATIONS public limited company Method of remotely storing data and related data storage system
CN102236718A (zh) * 2011-07-20 2011-11-09 中兴通讯股份有限公司 一种数据查询的方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236554B (zh) * 2007-11-29 2011-05-11 中兴通讯股份有限公司 一种数据库海量数据比对的方法
CN101753373A (zh) * 2008-12-19 2010-06-23 中兴通讯股份有限公司 一种海量告警的查询方法及系统
CN101815012B (zh) * 2009-02-20 2012-04-04 中兴通讯股份有限公司 一种性能数据的采集方法及装置
CN101819603A (zh) * 2010-05-07 2010-09-01 中兴通讯股份有限公司 基于嵌入式系统的信息记录的检索方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127048A (zh) * 2007-08-20 2008-02-20 华为技术有限公司 一种查询结果处理方法与装置
CN101247271A (zh) * 2008-03-24 2008-08-20 中兴通讯股份有限公司 性能数据的存储方法和装置
EP2237144A1 (en) * 2009-03-31 2010-10-06 BRITISH TELECOMMUNICATIONS public limited company Method of remotely storing data and related data storage system
CN102236718A (zh) * 2011-07-20 2011-11-09 中兴通讯股份有限公司 一种数据查询的方法及装置

Also Published As

Publication number Publication date
CN102236718A (zh) 2011-11-09
CN102236718B (zh) 2019-09-13

Similar Documents

Publication Publication Date Title
US5899986A (en) Methods for collecting query workload based statistics on column groups identified by RDBMS optimizer
CN104361042B (zh) 一种信息检索方法及装置
CN107733869B (zh) 一种设备识别方法及装置
CN102184222B (zh) 一种在大数据量存储中快速检索的方法
CN102332030A (zh) 用于分布式键-值存储系统的数据存储、管理和查询方法及系统
CN107329983B (zh) 一种机器数据分布式存储、读取方法及系统
CN106709851B (zh) 大数据检索方法及装置
WO2012174906A1 (zh) 一种数据存储、查找方法及装置
CN104850564B (zh) 数据文件的索引查找方法和系统
CN107783974B (zh) 数据处理系统及方法
CN102169491B (zh) 一种多数据集中重复记录动态检测方法
WO2015048525A2 (en) System and method for managing network and security events via superimposing data
CN103259737A (zh) 一种并行存储高速网络流量的快速定位方法
CN107644033B (zh) 一种在非关系型数据库中进行数据查询的方法与设备
CN101079074A (zh) 一种数据存储与检索的方法及系统
CN107241231B (zh) 一种原始网络数据包的快速精准定位方法
CN104636401A (zh) 一种scada系统数据回滚的方法及装置
WO2012151888A1 (zh) 一种数据查询的方法及装置
US10223529B2 (en) Indexing apparatus and method for search of security monitoring data
CN106599326B (zh) 一种云化架构下的记录数据剔重处理方法及系统
CN113268636A (zh) 一种基于时序数据的快速检索方法及装置
CN112131215B (zh) 自底向上的数据库信息获取方法及装置
CN109408727B (zh) 基于多维感知数据的用户关注信息智能推荐方法及系统
CN102622354A (zh) 一种基于特征向量的聚合数据快速查找方法
CN108460067B (zh) 基于数据的瓦片索引结构、索引构建方法和数据检索方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11865052

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11865052

Country of ref document: EP

Kind code of ref document: A1