CN108255981A - The storage and lookup method that section timestamp serial number index minute continuous time freezes - Google Patents
The storage and lookup method that section timestamp serial number index minute continuous time freezes Download PDFInfo
- Publication number
- CN108255981A CN108255981A CN201711458509.0A CN201711458509A CN108255981A CN 108255981 A CN108255981 A CN 108255981A CN 201711458509 A CN201711458509 A CN 201711458509A CN 108255981 A CN108255981 A CN 108255981A
- Authority
- CN
- China
- Prior art keywords
- record
- serial number
- timestamp
- storage
- continuous time
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2477—Temporal data queries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2272—Management thereof
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Probability & Statistics with Applications (AREA)
- Fuzzy Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- General Factory Administration (AREA)
Abstract
The storage freezed the invention discloses a kind of section timestamp serial number index minute continuous time and lookup method, including the identical freezing data in duration of freezing interval is stored together, the different freezing data in duration of freezing interval stores respectively, forms offshoot program storage;According to continuous time section, identification is proposed to the freezing data in offshoot program storage and divides continuous time section;Settling time stamp serial number index round-robin queue;It is indexed according to the timestamp serial number of foundation, the lookup method indexed based on timestamp serial number is provided, obtain the actual storage locations of any record in continuous time section.The present invention without setting up moon concordance list, day concordance list, when concordance list, it can realize that magnanimity minute freezes to record data storage and lookup method, substantially increase search efficiency, it is improving except search efficiency, index space can be greatly reduced, record storage space is effectively compressed, is had a good application prospect.
Description
Technical field
The present invention relates to intelligent electric energy meter technical fields, and in particular to a kind of continuous time section timestamp serial number index minute
The storage freezed and lookup method.
Background technology
With the development and the improvement of people's living standards of national economy technology, electric energy has become people's production and life
Essential secondary energy sources in work, production and life to people bring endless facility.Electric energy meter is as electric system
The unique parts of middle metering electric energy, importance and reliability are self-evident.
It is intelligent electric meter to the note of real-time electric power load operating region during Operation of Electric Systems, feature that minute, which freezes,
Record, intelligent electric meter are freezed to record by time interval periodic recording minute set by user, and minute freezes which data object recorded
It is set by the user, the gap periods of each data object record and the depth capacity user of record can set.
With intelligent grid construction deeply and big data technology popularization and application, intelligent electric energy meter to minute freeze want
Ask higher and higher, newest code requirement intelligent electric energy meter, which can record nearest 28800 minutes, to be freezed to record, and can support to press
Time point, according to the time period range-based searching minute freeze to record;It is inevitable as user freezes minute the increase of record strip number requirement
Increase the memory capacity that minute freezes, even more increase the lookup difficulty that minute freezes, such as how lookup rapidly and efficiently point
It is current problem to be solved that clock, which freezes record,.At present, common electric energy meter minute freezes storage and lookup method, specifically such as
Under:
(1)Sequential storage search method, basic principle be successively sequential storage minute freeze to record, store every record when simultaneously
The markers of stored record is searched using the time as index in entirely record space by dichotomy during lookup, the shortcomings that
In:The entire record space of dichotomy traversal is used, with the increase of record strip number, searches what the record of specified time point needed
Time is longer, and the efficiency of lookup is low, cannot be met the needs of users when item number increases to certain item number;
(2)Traditional entire record space of dichotomy traversal is not adopted, but every class minute is freezed to record, and establishes moon index
Table, day concordance list, when concordance list, store every record when safeguard moon concordance list, day concordance list, when concordance list, then search
When by searching for moon concordance list, day concordance list, when concordance list obtain corresponding record, the shortcomings that be:Divide whenever storing 1 class
Clock freezes to record, to update simultaneously such minute freeze record the moon concordance list, day concordance list, when concordance list, algorithm is numerous and diverse;It looks into
Looked for for 1 class minute freezed to record, to search successively a moon concordance list, day concordance list, when concordance list can just obtain such minute and freeze to remember
It records minute in some hour and freezes the initial address recorded, if minute freezes to be divided into 1 minute between the storage time of record(Also
It is to have 60 minutes to freeze to record in this hour), also to freeze to carry out in 60 records of record in such minute further
Sequential search can just obtain the record of that specific minute in this hour(If 59 points of the record of this hour, suitable
Sequence searches 59 minutes that can just obtain 59 points and freezes to record), and the ground for directly obtaining record can not be calculated by once linear
Location;In addition, being indexed by establishing the moon, the data of nearest 1 year can only be preserved at most, and cannot preserve data for many years recently, it
The record number of want to save is more, then indexes the moon established, day indexes, hour index is also more;
How the above problem is overcome, it is current to be badly in need of solving.
Invention content
The problems of the purpose of the present invention is existing electric energy meter minute is overcome to freeze storage and lookup method,.This
The storage and lookup method that section timestamp serial number index minute continuous time of invention freezes, without setting up moon concordance list, day rope
Draw table, when concordance list, it is possible to realize magnanimity minute freeze record data storage and lookup method, substantially increase lookup effect
Rate is improving except search efficiency, can greatly reduce index space, be effectively compressed record storage space, has good application
Prospect.
In order to achieve the above object, the technical solution adopted in the present invention is:
The storage and lookup method that a kind of continuous time section timestamp serial number index minute freezes, include the following steps,
Step(A), the identical freezing data in duration of freezing interval is stored together, the different freezing data in duration of freezing interval point
It does not store, forms offshoot program storage;
Step(B), according to continuous time section, identification is proposed to the freezing data in offshoot program storage and divides continuous time section,
The continuous time section, refers to that a centre does not undergo power down or changes the continuous natural time section of time, continuous at this
In period, the time interval between former and later two chill points is equal to duration of freezing;If power down occurs or changes the time, cause
Discontinuous event is recorded, then creates a new continuous time section;
Step(C), settling time stamp serial number index round-robin queue, in step(B)A new continuous time section is often created to be somebody's turn to do
First record of continuous time section establishes a timestamp serial number index, and the timestamp serial number index includes the consecutive hours
Between the serial number of the timestamp of first record and first record in section;
Step(D), indexed according to the timestamp serial number of foundation, the lookup method indexed based on timestamp serial number provided, using two
Point-score is searched in timestamp sequence number cycle queue, is found the timestamp serial number where user asks record and is indexed, obtains
The timestamp and first serial number recorded of first record in corresponding continuous time section, so as to calculate the continuous time
The time of origin and record number of any record in section, and according to record number, obtain any in continuous time section
The actual storage locations of one record.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(A), will freeze
The identical freezing data of period distances stores together, and the different freezing data in duration of freezing interval stores respectively, forms offshoot program
Storage will be the data field physical block that each scheme divides stored record, while divide storage time for each scheme and stab serial number
The index area physical block of round-robin queue is indexed, the data field physical block that each scheme divides stored record each freezes item
Duration of freezing is identical, and every data length for freezing record is isometric, i.e., data field physical block is isometric round-robin queue
Data field in the serial number for knowing a record, according to the serial number of the record, directly calculates this and is recorded in depositing for physical space
Deviant OFFSET is stored up, calculation formula is OFFSET=(RCD_SEQ_NO % MAX) * RCRD_SZ, wherein, RCD_SEQ_
NO is the serial number of the record, and MAX is the maximum memory space entry number for distributing to this offshoot program storage scheme, and RCRD_SZ is
The length of single record.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(B)If occur
Power down changes the time, causes to record discontinuous event, then creates a new continuous time section, the generation power down or
Change the time, when leading to record discontinuous event and referring to power down occurs or changes the time across corresponding duration of freezing, then create
One new continuous time section.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(C), when described
Between stamp serial number index, include the continuous time section in first record timestamp and first record serial number, when described
Between stamp freeze the number of minutes of fiducial time, and account for four byte spaces for first record time of origin is opposite;Described first
During every record storage of serial number of record, the logical sequence number of every record is distributed to, serial number is started from scratch, a nearest record
Serial number CNTS -1, CNTS is the summary journal item number of the offshoot program storage scheme, and serial number accounts for four byte spaces.
The storage and lookup method that aforementioned continuous time section timestamp serial number index minute freezes, it is described when freezing benchmark
Between 0 divide when being 1 day 0 January in 2000, can be adjusted as needed.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(D), so as to count
The time of origin and record number of any record in continuous time section are calculated, and according to record number, it is continuous to obtain this
The actual storage locations of any record in period, include the following steps,
(D11), user's request time is subtracted into upper first timestamp for recording point of this continuous time section and obtains a time difference,
By the time difference divided by the duration of freezing of the offshoot program storage scheme, obtain user ask record continuous time section thus which
Item records RCD_NUM.
(D12), which item for asking to record continuous time section thus according to obtained user RCD_NUM is recorded, is calculated
The serial number of user request record, the serial number of first record that serial number timestamp serial number index preserves add RCD_NUM,
And according to the serial number of the record, directly calculate the storage deviant that this is recorded in physical space to record to this
Actual storage locations.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(D), work as calculating
Include the following steps during the actual storage locations of n-th record in continuous time section in one offshoot program storage scheme,
(D21), the calculation formula of the serial number SEQ_NO of n-th record is SEQ_NO=CNTS-N;Wherein, CNTS is this point
The summary journal item number of scheme storage scheme;
(D22), according to the serial number SEQ_NO that n-th records, directly calculate the storage offset that n-th is recorded in physical space
Value is to get the actual storage locations recorded to this.
The storage and lookup method that aforementioned section timestamp serial number index minute continuous time freezes, step(D), work as calculating
During the actual storage locations recorded earliest in continuous time section in one offshoot program storage scheme, include the following steps,
(D31), the timestamp serial number pointed by the owner pointer of the timestamp serial number index round-robin queue of the offshoot program storage scheme
It indexes and is indexed for timestamp serial number where recording earliest, the sequence for directly obtaining and recording earliest is obtained from timestamp serial number index
Number;
(D32), according to the serial number recorded earliest, directly calculate be recorded in earliest the storage deviant of physical space to get to
The actual storage locations of this record.
The beneficial effects of the invention are as follows:The storage and look into that section timestamp serial number index minute continuous time of the present invention freezes
Look for method, without setting up moon concordance list, day concordance list, when concordance list, it is possible to realize magnanimity minute freeze record data storage
And lookup method, search efficiency is substantially increased, it is of the invention based on continuous time section timestamp serial number index, only in user
New index will just be established in special circumstances by changing the time or power down etc. occurring, and index space be greatly saved, using offshoot program
Storage scheme, each node do not have to stored record time of origin, save data space, are calculated with 5 byte of each time point(Year
The time-division day moon), 28800 records can save 140KB memory spaces, therefore, improve except search efficiency, can greatly reduce rope
Draw space, be effectively compressed record storage space, have a good application prospect.
Description of the drawings
Fig. 1 is the storage freezed section timestamp serial number index minute continuous time of the present invention and the flow of lookup method
Figure;
Fig. 2 is that the schematic diagram of timestamp serial number index memory space is respectively divided in multiple schemes of the embodiment of the present invention;
Fig. 3 is the schematic diagram of the data structure storage body of the embodiment of the present invention;
Fig. 4 is the flow chart of the record storage flow of the embodiment of the present invention;
Fig. 5 is the flow chart for searching specified time point record flow of the embodiment of the present invention;
Fig. 6 is that the lookup of the embodiment of the present invention is more than or equal to the flow chart of specified time record flow;
Fig. 7 is the flow chart for searching specified time range record flow of the embodiment of the present invention;
Fig. 8 is that the past historical time of the embodiment of the present invention changes the flow chart of time flow.
Specific embodiment
Below in conjunction with Figure of description, the present invention is further illustrated.
The storage and lookup method that section timestamp serial number index minute continuous time of the present invention freezes, as shown in Figure 1, packet
Include following steps,
Step(A), the identical freezing data in duration of freezing interval is stored together, the different freezing data in duration of freezing interval point
It does not store, forms offshoot program storage, to be the data field physical block that each scheme divides stored record, while drawn for each scheme
Divide the index area physical block of storage time stamp serial number index round-robin queue, each scheme divides the data field object of stored record
The duration of freezing that reason block each freezes item is identical, and every data length for freezing record is isometric, i.e. data field physical block
For isometric round-robin queue data field, in the serial number for knowing a record, according to the serial number of the record, this note is directly calculated
The storage deviant OFFSET in physical space is recorded, calculation formula is OFFSET=(RCD_SEQ_NO % MAX) * RCRD_
SZ, wherein, RCD_SEQ_NO is the serial number of the record, and MAX is the maximum memory space item for distributing to this offshoot program storage scheme
Mesh number, RCRD_SZ are the length of single record,
Minute freezes to freeze as a kind of period, and the period freezes to be exactly to freeze object by the gap periods of setting to be freezed, than
Such as freezed primary or interval at interval of 1 minute to freeze within 5 minutes once or be spaced to freeze within 15 minutes primary, step(A)It is built upon
To in the understanding and excavation of electric energy meter periodicity freezing characteristic, if first characteristic is exactly by the identical jelly in duration of freezing interval
Knot data store together, are spaced different storages respectively, then then, every record size of data of storage is each freeze-off time
Identical, the record queue so stored in chronological order is isometric record queue, and data storage is isometric storage, this
It is first characteristic periodically freezed;
Step(B), according to continuous time section, identification is proposed to the freezing data in offshoot program storage and divides continuous time section,
The continuous time section, refers to that a centre does not undergo power down or changes the continuous natural time section of time, continuous at this
In period, the time interval between former and later two chill points is equal to duration of freezing;If power down occurs or changes the time, cause
Discontinuous event is recorded, then creates a new continuous time section, step(B)It is demonstrated by periodically freeze second spy
Property and a most important characteristic, if not occurring power down, changing the paroxysmal event such as time or operation(Only power down or
Change that the time can cause periodically to freeze to freeze record discontinuous), it is all Coutinuous store in chronological order periodically to freeze(Even
It renews storage and refers to that the time difference of front and rear two records in queue is exactly equal to duration of freezing), only it is to be understood that this continuous time section
First record position, it is possible to the storage location of any record in this continuous time section is calculated, thus will
Any record in this continuous time section is quickly found out;And the power grid modernized, the situation for occurring having a power failure are even more
It is fewer and fewer(Generally, as soon as year in seldom occur repeatedly have a power failure, the taiwan area where me, recent years be even more do not have a power failure once,
It is just that some Special sections 1 year have a power failure 100 times, year is only also divided into 100 continuous times sections, 1 year
Have a power failure 100 times, this is more appalling);
Step(C), settling time stamp serial number index round-robin queue, in step(B)A new continuous time section is often created to be somebody's turn to do
First record of continuous time section establishes a timestamp serial number index, and the timestamp serial number index includes the consecutive hours
Between the serial number of the timestamp of first record and first record in section, the timestamp serial number index includes the consecutive hours
Between the serial number of the timestamp of first record and first record in section, the timestamp is first record time of origin phase
To freezing the number of minutes of fiducial time, and account for four byte spaces;During every record storage of serial number of first record,
The logical sequence number of every record is distributed to, serial number is started from scratch, and the serial number CNTS -1, CNTS of a nearest record are this point
The summary journal item number of scheme storage scheme, serial number account for four byte spaces, and fiducial time of freezing of the invention is in January, 2000
0 divides at 1 day 0, can be adjusted as needed, the foundation rule of timestamp serial number index of the present invention, specific as follows:
1)Timestamp serial number index is round-robin queue, is recycled, and queue heads are directed toward by owner pointer start(It is namely effective
First index), rear of queue is directed toward by tail pointer end(The last one namely effective index);
2)First record of this scheme(Namely electric energy meter first powers on first record recorded after operation)It need to create
First timestamp serial number index;
3)Electric energy meter power down changes the time toward future time(I.e. the time becomes larger)When causing to record discontinuous, need at this time one newly-built
Timestamp serial number indexes, and ensures that each index is directed toward first in a continuous time section and records with this, it is ensured that be each
Continuous time section has created a timestamp serial number index, it is ensured that an indexed record of index is continuous in time
, without breakpoint;
4)Change the time toward historical time(I.e. the time becomes smaller), all in coated region are recorded into corresponding rear of queue timestamp
Serial number index deactivates, and the new record hereafter recorded creates timestamp serial number index;
5)The corresponding continuous time segment record of timestamp serial number index reaches the single timestamp serial number index dominant record number of setting
When, create a timestamp serial number index(This rule is not essential, optional deployment, as long as timestamp serial number index queue
Size is more than the power down being likely to occur or changes time number);
Step(D), indexed according to the timestamp serial number of foundation, the lookup method indexed based on timestamp serial number provided, using two
Point-score is searched in timestamp sequence number cycle queue, is found the timestamp serial number where user asks record and is indexed, obtains
The timestamp and first serial number recorded of first record in corresponding continuous time section, so as to calculate the continuous time
The time of origin and record number of any record in section, and according to record number, obtain any in continuous time section
The actual storage locations of one record,
Wherein, the time of origin and record number of any record in continuous time section are calculated, and according to record number,
The actual storage locations of any record in continuous time section are obtained, are included the following steps,
(D11), user's request time is subtracted into upper first timestamp for recording point of this continuous time section and obtains a time difference,
By the time difference divided by the duration of freezing of the offshoot program storage scheme, obtain user ask record continuous time section thus which
Item records RCD_NUM.
(D12), which item for asking to record continuous time section thus according to obtained user RCD_NUM is recorded, is calculated
The serial number of user request record, the serial number of first record that serial number timestamp serial number index preserves add RCD_NUM,
And according to the serial number of the record, directly calculate the storage deviant that this is recorded in physical space to record to this
Actual storage locations;
When calculating the actual storage locations of n-th record in continuous time section in an offshoot program storage scheme, including following
Step,
(D21), the calculation formula of the serial number SEQ_NO of n-th record is SEQ_NO=CNTS-N;Wherein, CNTS is this point
The summary journal item number of scheme storage scheme;
(D22), according to the serial number SEQ_NO that n-th records, directly calculate the storage offset that n-th is recorded in physical space
Value is to get the actual storage locations recorded to this.
When calculating the actual storage locations recorded earliest in the section of continuous time in an offshoot program storage scheme, including with
Lower step,
(D31), the timestamp serial number pointed by the owner pointer of the timestamp serial number index round-robin queue of the offshoot program storage scheme
It indexes and is indexed for timestamp serial number where recording earliest, the sequence for directly obtaining and recording earliest is obtained from timestamp serial number index
Number;
(D32), according to the serial number recorded earliest, directly calculate be recorded in earliest the storage deviant of physical space to get to
The actual storage locations of this record.
The storage and lookup method that continuous time section timestamp serial number index minute according to the present invention freezes, introduce a tool
Body embodiment,
(1)All minutes to freeze are freezed record data object to classify, the duration of freezing of storage is identical
It is divided into 1 class, forms a storage scheme, according to the data item in this scheme, calculates every record length of this scheme as PER_
LEN so forms multiple schemes altogether;
(2)The maximum memory space entry number MAX of this scheme is distributed in the storage depth decision required according to user, will be distributed to
The amount of physical memory that minute freezes record is divided, and each storage scheme divides a recorded data zone physical space block,
It is MAX * PER_LEN per class physical space block size;The physical space block formed is divided, as shown in Fig. 2, for multiple schemes point
Not Hua Fen timestamp serial number index memory space, according to the power down that is likely to occur or change time situation and determine each scheme index slip
Mesh number, can also be according to the maximum memory space entry number MAX of each scheme and single timestamp serial number index dominant record
Number determines each scheme index slip mesh number;One timestamp serial number indexes round-robin queue, as shown in figure 3, for each conceptual design
Protocol structure memory bank, protocol structure memory bank preserve scheme and currently freeze affiliated partner item;Each scheme is current
Record number CNTS and current time stamp serial number index owner pointer(start), tail pointer(end);Each scheme stores first
During record, first timestamp serial number index is created in timestamp serial number index queue, wherein first record in index
Timestamp records the number of minutes relative to fiducial time for this, and the serial number SEQ_NO of first record is 0 in indexing;Electric energy
It powered on again after table power down, change the time toward future time(I.e. the time becomes larger)If it detects between power down time and power-on time
There is a situation where across duration of freezing or change the time and cause across duration of freezing, i.e., next new to freeze record and nearest one jelly
Knot record is discontinuous in time, and there is breakpoint in centre, then record next time is new refers to timestamp serial number index tail when freezing record
It is moved after needle, and new record creates timestamp serial number index, record storage flow thus, as shown in figure 4, according to duration of freezing and working as
The preceding time judges whether duration of freezing arrives;According to current record number CNTS as current record serial number, calculated according to record number
Record storage position stored record;A new continuous time section is determined whether, if a new continuous time Duan Ze
A timestamp serial number index is created in timestamp serial number index round-robin queue;Current record number CNTS adds 1;
(3)Search the record of specified time point:
Each index is arranged by the time order and function sequence of section of each continuous time in timestamp serial number index round-robin queue
, it is an orderly ascending order queue, can be obtained by so being searched in timestamp serial number indexes round-robin queue using dichotomy
Specified time corresponding timestamp serial number index obtains corresponding timestamp serial number index and is obtained with timestamp serial number index
The time of the corresponding upper first record point of continuous time section, user's request time is subtracted into upper first note of this continuous time section
The time of record point obtains a time difference, and it is this company that the duration of freezing of this time difference divided by this scheme, which is obtained user to ask record,
Which item record of continuous period(It is set as RCD_NUM)If RCD_NUM is more than the lower record strip number of this time stamp(According to calculating
The method of physical record item number can obtain the lower record strip number of this time stamp under one timestamp), then user's request time point is not
There are records, and otherwise RCD_NUM is less than or equal to the lower record strip number of this time stamp, then the serial number that user's request records(It is set as RCD_
SEQ_NO)For SEQ_NO+RCD_NUM, user asks to be recorded as in the corresponding continuous time section of this time stamp serial number index
The RCD_NUM articles record, so just obtain user ask record record number;
Since the present invention is to carry out offshoot program storage according to different duration of freezing, every record in each scheme is
It is long, distribute to the physical space of this scheme record so this can be calculated according to record number (RCD_SEQ_NO) and be recorded in
OFFSET is deviated, formula is to distribute to this scheme most for OFFSET=(RCD_SEQ_NO % MAX) * RCRD_SZ, MAX
Big memory space entry number, idiographic flow, as shown in figure 5,
(3)It searches and is more than or equal to specified time record flow:
This flow is for searching the record that a time is more than or equal to user's specified time, if there is equal to user's specified time
Record then return to this record, otherwise continue to search for a time be more than user's specified time record, idiographic flow, such as Fig. 6
Shown, process description is as follows:
By user ask specified time be converted to 4 bytes apart from fiducial time the number of minutes timestamp;
The timestamp of user's request time is aligned by duration of freezing;
It is indexed in timestamp serial number and carries out binary search between round-robin queue's owner pointer and tail pointer;It is returned if failure is searched
Return no record;
Calculate the lower physical record item number of this time stamp serial number index;
Calculate user's request time is which lower item record of timestamp serial number index(This number is set as RCD_NUM);
If RCD_NUM is less than or equal to the lower physical record item number of this time stamp serial number index, user's request time correspondence is obtained
The record number of record indexes lower first record number SEQ_NO+RCD_NUM for timestamp serial number;Otherwise current time is taken
The next timestamp of stamp is timestamp serial number index where searching record, obtains the note of first after user's specified time record
It records serial number this time stamp serial number and indexes lower first record number SEQ_NO;
(4)The record in the range of specified time, idiographic flow are looked for, as shown in fig. 7, process description is as follows:
The end time is judged, if the end time of user's request, which is more than the last item, records the time, at the end of lookup
Between be set to the last item record the time;
It calls to search and is more than or equal to specified time record interface acquisition initial time corresponding record serial number and position;
It calls to search and is more than or equal to specified time record interface acquisition end time corresponding record serial number and position;
(5)Search n-th record
When user asks to search record, this module passes through serial number SEQ_NO(During every record storage of serial number, every note is distributed to
The logical sequence number of record, serial number is since 0, the serial number CNTS -1 of a nearest record)Index every record, upper n times record
The calculation formula of serial number is:SEQ_NO = CNTS – N;
(6)Search record earliest
Timestamp serial number index pointed by timestamp serial number index round-robin queue owner pointer is exactly timestamp where earliest record
Serial number indexes, and the serial number SEQ_NO for directly obtaining and recording earliest is obtained from this timestamp serial number index;
(7)Change the time when past historical time occurs(I.e. the time becomes smaller), traveling time stamp serial number index round-robin queue tail pointer will
All in coated region record corresponding rear of queue timestamp serial number index and deactivate, and hereafter new record freezes to record stylish
Build timestamp serial number index;Change time-triggered protocol flow toward historical time, as shown in Figure 8.
In conclusion the minute of the continuous time section timestamp serial number index of the present invention freezes storage and lookup method, packet
It includes and stores the identical freezing data object of duration of freezing together, the different storage respectively of duration of freezing is formed by duration of freezing
The offshoot program storage that identical object stores together;According to power down or change these particular events of time and operation identification and the company of division
The continuous period stabs serial number index in stored record for each new section settling time continuous time, and timestamp serial number index is protected
The timestamp of first record of this continuous time section and the serial number of first record are deposited;Time based on continuous time section
Stab the binary search of serial number index round-robin queue, it is possible to the timestamp serial number index that user asks record place is found,
The time of origin and first serial number recorded of first record in this continuous time section are obtained, it is possible thereby to which it is continuous to calculate this
The time of origin and record number of any record in period can calculate any record according to record number
Actual storage locations, thus complete to any one record lookup;By using the method based on continuous time section
Timestamp serial number index can greatly reduce records be must be set up index memory space to search, while improves magnanimity minute jelly
The search efficiency of data is tied, is had a good application prospect.
Basic principle, the main features and advantages of the present invention have been shown and described above.The technical staff of the industry should
Understand, the present invention is not limited to the above embodiments, and the above embodiments and description only describe the originals of the present invention
Reason, without departing from the spirit and scope of the present invention, various changes and improvements may be made to the invention, these changes and improvements
It all fall within the protetion scope of the claimed invention.The claimed scope of the invention is by appended claims and its equivalent circle
It is fixed.
Claims (8)
1. storage and lookup method that a kind of continuous time section timestamp serial number index minute freezes, it is characterised in that:Including with
Lower step,
Step(A), the identical freezing data in duration of freezing interval is stored together, the different freezing data in duration of freezing interval point
It does not store, forms offshoot program storage;
Step(B), according to continuous time section, identification is proposed to the freezing data in offshoot program storage and divides continuous time section,
The continuous time section, refers to that a centre does not undergo power down or changes the continuous natural time section of time, continuous at this
In period, the time interval between former and later two chill points is equal to duration of freezing;If power down occurs or changes the time, cause
Discontinuous event is recorded, then creates a new continuous time section;
Step(C), settling time stamp serial number index round-robin queue, in step(B)A new continuous time section is often created to be somebody's turn to do
First record of continuous time section establishes a timestamp serial number index, and the timestamp serial number index includes the consecutive hours
Between the serial number of the timestamp of first record and first record in section;
Step(D), indexed according to the timestamp serial number of foundation, the lookup method indexed based on timestamp serial number provided, using two
Point-score is searched in timestamp sequence number cycle queue, is found the timestamp serial number where user asks record and is indexed, obtains
The timestamp and first serial number recorded of first record in corresponding continuous time section, so as to calculate the continuous time
The time of origin and record number of any record in section, and according to record number, obtain any in continuous time section
The actual storage locations of one record.
2. storage and lookup method that continuous time section timestamp serial number index minute according to claim 1 freezes,
It is characterized in that:Step(A), the identical freezing data in duration of freezing interval is stored together, duration of freezing interval is different to freeze
Data store respectively, form offshoot program storage, to be the data field physical block that each scheme divides stored record, while be each
Scheme divides the index area physical block of storage time stamp serial number index round-robin queue, and each scheme divides the number of stored record
The duration of freezing for each freezing item according to area's physical block is identical, and every data length for freezing record is isometric, i.e. data field
Physical block is isometric round-robin queue data field, in the serial number for knowing a record, according to the serial number of the record, is directly calculated
This is recorded in the storage deviant OFFSET of physical space, and calculation formula is OFFSET=(RCD_SEQ_NO % MAX) *
RCRD_SZ, wherein, RCD_SEQ_NO is the serial number of the record, and MAX is the maximum storage for distributing to this offshoot program storage scheme
Space entry number, RCRD_SZ are the length of single record.
3. storage and lookup method that continuous time section timestamp serial number index minute according to claim 1 freezes,
It is characterized in that:Step(B)If power down occurs or changes the time, cause to record discontinuous event, then create a new company
The continuous period, the generation power down, which either changes the time, to be caused to record span when discontinuous event refers to power down occurs or changes
When crossing corresponding duration of freezing, then a new continuous time section is created.
4. storage and lookup method that continuous time section timestamp serial number index minute according to claim 1 freezes,
It is characterized in that:Step(C), timestamp serial number index, the timestamp comprising first record in continuous time section and
The serial number of first record, the timestamp freeze the number of minutes of fiducial time, and account for relatively for first record time of origin
Four byte spaces;During every record storage of serial number of first record, the logical sequence number of every record, sequence are distributed to
Number start from scratch, the serial number CNTS -1, CNTS of a nearest record are the summary journal item number of the offshoot program storage scheme, sequence
Number account for four byte spaces.
5. storage and lookup method that continuous time section timestamp serial number index minute according to claim 4 freezes,
It is characterized in that:It is described to freeze fiducial time and 0 divide when being 1 day 0 January in 2000, it can be adjusted as needed.
6. storage and lookup method that continuous time section timestamp serial number index minute according to claim 2 freezes,
It is characterized in that:Step(D), so as to calculate the time of origin and record number of any record in continuous time section, and
According to record number, the actual storage locations of any record in continuous time section are obtained, are included the following steps,
(D11), user's request time is subtracted into upper first timestamp for recording point of this continuous time section and obtains a time difference,
By the time difference divided by the duration of freezing of the offshoot program storage scheme, obtain user ask record continuous time section thus which
Item records RCD_NUM;
(D12), which item for asking to record continuous time section thus according to obtained user RCD_NUM is recorded, calculates the use
The serial number of record is asked at family, and the serial number of first record that serial number timestamp serial number index preserves adds RCD_NUM, and root
According to the serial number of the record, storage deviant that this is recorded in physical space is directly calculated to get the reality recorded to this
Storage location.
7. storage and lookup method that continuous time section timestamp serial number index minute according to claim 2 freezes,
It is characterized in that:Step(D), when the actual storage position for calculating n-th record in continuous time section in an offshoot program storage scheme
When putting, include the following steps,
(D21), the calculation formula of the serial number SEQ_NO of n-th record is SEQ_NO=CNTS-N;Wherein, CNTS is this point
The summary journal item number of scheme storage scheme;
(D22), according to the serial number SEQ_NO that n-th records, directly calculate the storage offset that n-th is recorded in physical space
Value is to get the actual storage locations recorded to this.
8. storage and lookup method that continuous time section timestamp serial number index minute according to claim 2 freezes,
It is characterized in that:Step(D), when calculating the actual storage locations that are recorded earliest in the section of continuous time in an offshoot program storage scheme
When, include the following steps,
(D31), the timestamp serial number pointed by the owner pointer of the timestamp serial number index round-robin queue of the offshoot program storage scheme
It indexes and is indexed for timestamp serial number where recording earliest, the sequence for directly obtaining and recording earliest is obtained from timestamp serial number index
Number;
(D32), according to the serial number recorded earliest, directly calculate be recorded in earliest the storage deviant of physical space to get to
The actual storage locations of this record.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711458509.0A CN108255981B (en) | 2017-12-28 | 2017-12-28 | Method for storing and searching index minute freezing of timestamp sequence numbers of continuous time periods |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711458509.0A CN108255981B (en) | 2017-12-28 | 2017-12-28 | Method for storing and searching index minute freezing of timestamp sequence numbers of continuous time periods |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108255981A true CN108255981A (en) | 2018-07-06 |
CN108255981B CN108255981B (en) | 2020-05-22 |
Family
ID=62724325
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711458509.0A Active CN108255981B (en) | 2017-12-28 | 2017-12-28 | Method for storing and searching index minute freezing of timestamp sequence numbers of continuous time periods |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108255981B (en) |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109614447A (en) * | 2018-10-15 | 2019-04-12 | 国网新疆电力有限公司阿克苏供电公司 | A kind of intelligent electric meter divides the storage method, querying method and device of freezing data |
CN110688362A (en) * | 2019-08-27 | 2020-01-14 | 浙江浙大中控信息技术有限公司 | Data sectional type storage method based on time stamp |
CN110968605A (en) * | 2019-12-16 | 2020-04-07 | 成都长城开发科技有限公司 | Method and device for searching curve data of electric meter |
CN111324310A (en) * | 2020-02-26 | 2020-06-23 | 中国邮政储蓄银行股份有限公司 | Data reading method and device and computer system |
CN112419698A (en) * | 2020-10-26 | 2021-02-26 | 浙江正泰仪器仪表有限责任公司 | Electric energy meter data transmission method, system and device based on distribution line message specification |
CN112965919A (en) * | 2021-03-24 | 2021-06-15 | 深圳友讯达科技股份有限公司 | Electric energy meter data minute freezing method, storage medium and equipment |
CN113220692A (en) * | 2021-06-01 | 2021-08-06 | 烟台东方威思顿电气有限公司 | Load curve data access method |
CN113254451A (en) * | 2021-06-01 | 2021-08-13 | 北京城市网邻信息技术有限公司 | Data index construction method and device, electronic equipment and storage medium |
CN113918578A (en) * | 2020-07-10 | 2022-01-11 | 成都秦川物联网科技股份有限公司 | Power failure data supplementing and storing method for Internet of things intelligent gas meter |
CN114356792A (en) * | 2021-11-18 | 2022-04-15 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN116204684A (en) * | 2023-02-01 | 2023-06-02 | 浙江正泰仪器仪表有限责任公司 | Storage method, device, equipment and medium of electric energy meter |
CN116303124A (en) * | 2023-03-29 | 2023-06-23 | 浙江正泰仪器仪表有限责任公司 | Data searching method and device, electronic equipment and storage medium |
CN116719845A (en) * | 2023-08-07 | 2023-09-08 | 烟台东方威思顿电气有限公司 | Quick query method for periodic frozen data of electric energy meter |
CN116204684B (en) * | 2023-02-01 | 2024-06-04 | 浙江正泰仪器仪表有限责任公司 | Storage method, device, equipment and medium of electric energy meter |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090132567A1 (en) * | 2007-11-20 | 2009-05-21 | General Electric Corporation | Compressed data storage to provide recent and summary data |
CN105718218A (en) * | 2016-01-19 | 2016-06-29 | 国电南瑞三能电力仪表(南京)有限公司 | Compressed storage method and system applicable for load records of electric energy meter or concentrator |
CN107330031A (en) * | 2017-06-26 | 2017-11-07 | 广州华多网络科技有限公司 | A kind of method of data storage, device and electronic equipment |
-
2017
- 2017-12-28 CN CN201711458509.0A patent/CN108255981B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090132567A1 (en) * | 2007-11-20 | 2009-05-21 | General Electric Corporation | Compressed data storage to provide recent and summary data |
CN105718218A (en) * | 2016-01-19 | 2016-06-29 | 国电南瑞三能电力仪表(南京)有限公司 | Compressed storage method and system applicable for load records of electric energy meter or concentrator |
CN107330031A (en) * | 2017-06-26 | 2017-11-07 | 广州华多网络科技有限公司 | A kind of method of data storage, device and electronic equipment |
Non-Patent Citations (1)
Title |
---|
于宏文 等: "智能电网调度控制系统中历史数据服务优化方案", 《电力系统自动化》 * |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109614447A (en) * | 2018-10-15 | 2019-04-12 | 国网新疆电力有限公司阿克苏供电公司 | A kind of intelligent electric meter divides the storage method, querying method and device of freezing data |
CN110688362A (en) * | 2019-08-27 | 2020-01-14 | 浙江浙大中控信息技术有限公司 | Data sectional type storage method based on time stamp |
CN110968605A (en) * | 2019-12-16 | 2020-04-07 | 成都长城开发科技有限公司 | Method and device for searching curve data of electric meter |
CN111324310A (en) * | 2020-02-26 | 2020-06-23 | 中国邮政储蓄银行股份有限公司 | Data reading method and device and computer system |
CN113918578A (en) * | 2020-07-10 | 2022-01-11 | 成都秦川物联网科技股份有限公司 | Power failure data supplementing and storing method for Internet of things intelligent gas meter |
CN113918578B (en) * | 2020-07-10 | 2024-05-24 | 成都秦川物联网科技股份有限公司 | Method for storing power-down data of intelligent gas meter of Internet of things in full-order mode |
CN112419698A (en) * | 2020-10-26 | 2021-02-26 | 浙江正泰仪器仪表有限责任公司 | Electric energy meter data transmission method, system and device based on distribution line message specification |
CN112965919A (en) * | 2021-03-24 | 2021-06-15 | 深圳友讯达科技股份有限公司 | Electric energy meter data minute freezing method, storage medium and equipment |
CN113254451A (en) * | 2021-06-01 | 2021-08-13 | 北京城市网邻信息技术有限公司 | Data index construction method and device, electronic equipment and storage medium |
CN113220692A (en) * | 2021-06-01 | 2021-08-06 | 烟台东方威思顿电气有限公司 | Load curve data access method |
CN114356792A (en) * | 2021-11-18 | 2022-04-15 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN114356792B (en) * | 2021-11-18 | 2023-03-10 | 国电南瑞三能电力仪表(南京)有限公司 | Electric energy meter frozen data storage method based on FLASH pre-erasing technology and electric energy meter |
CN116204684A (en) * | 2023-02-01 | 2023-06-02 | 浙江正泰仪器仪表有限责任公司 | Storage method, device, equipment and medium of electric energy meter |
CN116204684B (en) * | 2023-02-01 | 2024-06-04 | 浙江正泰仪器仪表有限责任公司 | Storage method, device, equipment and medium of electric energy meter |
CN116303124A (en) * | 2023-03-29 | 2023-06-23 | 浙江正泰仪器仪表有限责任公司 | Data searching method and device, electronic equipment and storage medium |
CN116303124B (en) * | 2023-03-29 | 2024-01-30 | 浙江正泰仪器仪表有限责任公司 | Data searching method and device, electronic equipment and storage medium |
CN116719845A (en) * | 2023-08-07 | 2023-09-08 | 烟台东方威思顿电气有限公司 | Quick query method for periodic frozen data of electric energy meter |
CN116719845B (en) * | 2023-08-07 | 2023-11-10 | 烟台东方威思顿电气有限公司 | Quick query method for periodic frozen data of electric energy meter |
Also Published As
Publication number | Publication date |
---|---|
CN108255981B (en) | 2020-05-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108255981A (en) | The storage and lookup method that section timestamp serial number index minute continuous time freezes | |
CN102521405B (en) | Massive structured data storage and query methods and systems supporting high-speed loading | |
CN102521406B (en) | Distributed query method and system for complex task of querying massive structured data | |
CN102419752B (en) | Industrial database message storage method | |
CN104731799B (en) | Main memory DBM device | |
CN105488231B (en) | A kind of big data processing method divided based on adaptive table dimension | |
CN109471905B (en) | Block chain indexing method supporting time range and attribute range compound query | |
CN102289466A (en) | K-nearest neighbor searching method based on regional coverage | |
CN108920552B (en) | Distributed index method for multi-source large data stream | |
CN101944068A (en) | Performance optimization method for sharing cache | |
CN103914449A (en) | Multisource time series data compression storage method | |
CN103164418A (en) | Method and device for processing serial numbers | |
CN107491495B (en) | Storage method of the preferential space-time trajectory data file of space attribute in auxiliary storage device | |
CN107590157A (en) | A kind of date storage method, data query method and relevant device | |
CN106777387A (en) | A kind of Internet of Things big data access method based on HBase | |
CN110535825A (en) | A kind of data identification method of character network stream | |
CN108399231A (en) | A kind of collecting method and Flume data collection clients | |
CN106897458A (en) | A kind of storage and search method towards electromechanical equipment data | |
CN105741070B (en) | A kind of method of the quick difference update storage of the real-time freight space freight rate result data of magnanimity | |
CN104239447A (en) | Power-grid big time series data storage method | |
CN108108358B (en) | Storage and retrieval method for power quality data | |
CN104166596B (en) | A kind of memory allocation method and node | |
CN110688362A (en) | Data sectional type storage method based on time stamp | |
CN106227465A (en) | A kind of data placement method of ring structure | |
CN106021574A (en) | Data storage replication 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 |