CN109542912B - Interval data storage method, device, server and storage medium - Google Patents

Interval data storage method, device, server and storage medium Download PDF

Info

Publication number
CN109542912B
CN109542912B CN201811473550.XA CN201811473550A CN109542912B CN 109542912 B CN109542912 B CN 109542912B CN 201811473550 A CN201811473550 A CN 201811473550A CN 109542912 B CN109542912 B CN 109542912B
Authority
CN
China
Prior art keywords
value
attribute
values
score
initial
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.)
Active
Application number
CN201811473550.XA
Other languages
Chinese (zh)
Other versions
CN109542912A (en
Inventor
张志远
周寅生
石志中
张俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Ruian Technology Co Ltd
Original Assignee
Beijing Ruian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Ruian Technology Co Ltd filed Critical Beijing Ruian Technology Co Ltd
Priority to CN201811473550.XA priority Critical patent/CN109542912B/en
Publication of CN109542912A publication Critical patent/CN109542912A/en
Application granted granted Critical
Publication of CN109542912B publication Critical patent/CN109542912B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses a method and a device for storing interval data, a server and a storage medium. The method comprises the following steps: determining the initial value and the termination value of each interval range according to the initial value and the termination value of each interval range; and respectively constructing an initial record and an end record in the database according to the attribute value, the initial score value and the end score value of each interval range. The embodiment of the invention constructs the interval data into two groups of records for storage, and does not need to enumerate key value pairs of all the interval data, thereby realizing the high-efficiency storage of the interval data and saving the storage space.

Description

Interval data storage method, device, server and storage medium
Technical Field
The embodiment of the invention relates to the technical field of data storage, in particular to an interval data storage method, an interval data storage device, a server and a storage medium.
Background
With the advent of the data age, the rapid development of internet social networks and the like, the amount of data generated is also exponentially increased. For different data of sources and structures on the network, data governance is needed to meet the requirement of large data storage. According to the data governance strategy, different data can enter different positions of the data center for storage, such as a traditional relational database ORACLE, a distributed column-type database Hbase and the like. After data enters the data center through data management, data mining and analysis can be performed, and upper-layer services can be called.
Although various databases have been very versatile, for data that needs to be accessed frequently, faster access and reading are needed, and therefore the cached database is used to cache this portion of data. Common Redis databases cache data and store the data by adopting a Set data structure, but for the storage of interval data, all key value pairs need to be enumerated, indexes are established and the storage is carried out, the number of the interval data and the occupied memory keep a nonlinear relation, and a large amount of memory needs to be consumed. In addition, the Sorted Sets data structure is adopted to store the interval data, only the data which does not have overlapping in each group of interval ranges can be stored, and the storage of any interval data cannot be realized.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a server and a storage medium for storing interval data, which are used for storing any interval data and reducing the space memory occupied by data storage.
In a first aspect, an embodiment of the present invention provides an interval data storage method, where the method includes:
determining the initial value and the termination value of each interval range according to the initial value and the termination value of each interval range;
and respectively constructing an initial record and an end record in the database according to the attribute value, the initial score value and the end score value of each interval range.
In a second aspect, an embodiment of the present invention further provides an interval data storage apparatus, where the apparatus includes:
the score determining module is used for determining the initial score value and the termination score value of each interval range according to the initial value and the termination value of each interval range;
and the construction module is used for respectively constructing an initial record and an end record in the database according to the attribute value, the initial score value and the end score value of each interval range.
In a third aspect, an embodiment of the present invention further provides a server, where the server includes:
one or more processors;
a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement any of the interval data storage methods in embodiments of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements any one of the interval data storage methods in the embodiment of the present invention.
According to the embodiment of the invention, the initial value and the termination value of each interval range are determined according to the initial value and the termination value of each interval range, the initial record and the termination record are respectively constructed in the database according to the attribute value, the initial value and the termination value of each interval range, the interval data can be stored only by two groups of records without enumerating all key value pairs, the effective storage of the interval data is realized, and the storage space is saved.
Drawings
FIG. 1 is a flowchart illustrating a method for storing interval data according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a method for storing interval data according to a second embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an interval data storage apparatus according to a fourth embodiment of the present invention;
fig. 4 is a schematic structural diagram of a server in the fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
The section data storage method provided by the embodiment is applicable to the case of storing section data, and the method can be executed by a section data storage device, the device can be realized by software and/or hardware, and the device can be integrated in a server. Referring to fig. 1, the method of the present embodiment specifically includes the following steps:
and S110, determining the starting value and the ending value of each interval range according to the starting value and the ending value of each interval range.
The interval range is range data between a starting value and an ending value, the range data comprises a starting value and an ending value, the starting value and the ending value are used for representing the range data, the starting value is smaller than the ending value, the range data between the starting value and the ending value correspond to an attribute value, and the attribute values corresponding to the starting value, the ending value and the interval range form a record. The start value, the end value, and the range of the interval represented by the start value and the end value may be time, distance, height, transmission rate, IP address, etc., and it should be noted that the above-mentioned example is only an example where enumerated portions may be used for storing interval data by using the method of this embodiment, and the embodiment of the present invention is not limited to be used in the above-mentioned specific example, and interval data with clear start value and end value and corresponding attribute value may be stored by using the method of this embodiment.
Wherein, according to the initial value and the end value of each interval range, the initial value and the end value of each interval range are determined, and the method comprises the following steps: and determining the starting value and the ending value of each interval range according to the starting value and the ending value of each interval range based on a preset linear function. The preset function may be specifically set according to the types of the start value and the end value. For example, when the start value and the end value are integers, the start value and the end value are set as an independent variable x, and the corresponding start score value and end score value are set as a dependent variable y, then a linear function may be set as y ═ x, for example, the start value is 10 and the end value is 20, and then the start score value is 10 and the end score value is 20 according to a preset linear function. When the start value and the end value are time, the time, minute, and second of the start time and the end time are respectively set as independent variables x, y, and z, and the start score value and the end score value are set as dependent variables v, a linear function of v 3600x +60y + z may be set at this time, for example, 23 minutes and 15 seconds when the start time is 3. The ending time is 6 hours, 5 minutes and 36 seconds, the starting score value is 12195 according to a preset linear function, and the ending score value is 21936. The starting values and the ending values in various forms can be converted into integer values through a preset linear function to be used as the starting scoring values and the ending scoring values, and the starting scoring values and the starting values and the ending scoring values are in one-to-one correspondence, so that the storage and the search are convenient.
And S120, respectively constructing an initial record and a termination record in the database according to the attribute value, the initial score value and the termination score value of each interval range.
Specifically, the step of respectively constructing a start record and a stop record in the database according to the attribute value, the start score value and the stop score value of each interval range includes: taking the attribute values of all the interval ranges as elements in the initial record key value set, and taking the initial score values associated with all the attribute values as the score values of all the attribute values in the initial record key value set; and taking the attribute value of each interval range as an element in the termination record key value set, and taking the termination score value associated with each attribute value as the score value of each attribute value in the termination record key value set. Illustratively, an initial record is constructed in a form of Key-value (score), where Key is "initial record", and an initial record Key value set is constructed, elements in the Key value set are attribute values of each interval range, an initial score value associated with an attribute value is taken as a score value of the attribute value, an element in the Key value set is "attribute value (score value)", and the constructed initial record Key value set is value (score).
Correspondingly, a termination record is constructed in a form of Key-value (score), wherein Key is "termination record", and a termination record Key value set is constructed, elements in the Key value set are attribute values of each interval range, termination scoring values associated with the attribute values are used as scoring values of the attribute values, the attribute values (scoring values) "are used as elements in the Key value set, and the constructed termination record Key value set is" value (score) ". The initial value and the termination value are converted into the initial scoring value and the termination scoring value to serve as scoring values corresponding to the attribute values, and the initial record and the termination record are established, so that the interval data can be stored, all data in the interval data do not need to be enumerated and stored, the storage data volume is small, and the occupied space is reduced.
Optionally, respectively constructing a start record and a stop record in the database according to the attribute value, the start score value, and the stop score value of each interval range, further comprising: sorting the attribute values in the initial record key value set according to the grade values of the attribute values in the initial record key value set; and sorting the attribute values in the termination record key value set according to the grading values of the attribute values in the termination record key value set. Illustratively, the elements in the start record key value set are sorted in ascending order of the start score value of each attribute value, and the elements in the end record key value set are sorted in ascending order of the end score value of each attribute value. The size of each score value and the corresponding attribute value can be clearly reflected through sorting, so that subsequent searching is facilitated, and the searching efficiency is improved.
According to the technical scheme of the embodiment, the starting value score and the ending value score of each interval range are determined according to the starting value and the ending value of each interval range; and respectively constructing an initial record and an end record in the database according to the attribute value, the initial score value and the end score value of each interval range. According to the technical scheme in the embodiment, the interval data can be stored only by two groups of records without enumerating all key value pairs, so that the interval data can be effectively stored, and the storage space is saved.
Example two
The present embodiment is optimized based on the above embodiments, and details not described in detail in the present embodiment are described in the above embodiments. Referring to fig. 2, the interval data storage method provided in this embodiment includes:
s210, determining the starting value and the ending value of each interval range according to the starting value and the ending value of each interval range.
And S220, respectively constructing an initial record and a final record in the database according to the attribute value, the initial score value and the final score value of each interval range.
And S230, determining a target score value of the target value to be queried.
Specifically, a target score value of the target value to be queried is determined according to a preset linear function.
S240, searching attribute values with the score values smaller than the target score value from the initial record key value set to form a first attribute set.
Specifically, elements with the score values smaller than the target score value are searched from the starting record key value set, the attribute values with the score values smaller than the target score value are obtained, and the attribute values are combined into a first attribute set. Illustratively, if the starting record key value set is { a (5), B (7), E (11), C (14) }, and the target score value is 12, then the elements with score values smaller than 12 are found as { a (5), B (7), E (11) }fromthe starting record key value set, and the attribute values are grouped into a first attribute set, i.e., { a, B, E }.
And S250, searching attribute values with the score values equal to or larger than the target score value from the termination record key value set to form a second attribute set.
Specifically, elements with the score values smaller than the target score value are searched from the termination record key value set, the attribute values with the score values smaller than the target score value are obtained, and the attribute values are combined into a first attribute set. Illustratively, if the starting record key value set is { B (9), a (13), C (14), E (17) }, and the target score value is 12, then the elements with score values equal to or greater than 12 are found from the starting record key value set as { a (13), C (14), E (17) }, and the attribute values are grouped into a second attribute set, i.e., { a, C, E }.
S260, determining an intersection of the first attribute set and the second attribute set, and taking an attribute value in the intersection as a query result.
Specifically, an intersection of the first attribute set and the second attribute set is taken to obtain an attribute value in the intersection, and the attribute value is used as a query result, namely, an attribute value corresponding to a target value to be queried. Illustratively, an intersection of the first attribute set { a, B, E } and the second attribute set { a, C, E } is taken, i.e., { a, E }, where a and E are query results, i.e., attribute values corresponding to target values to be queried.
According to the technical scheme of the embodiment, the interval data is constructed into two groups of records to be stored, the initial record key value set and the termination record key value set are searched according to the target score value to obtain the first attribute set and the second attribute set, the intersection of the first attribute set and the second attribute set is determined to obtain the query result, the query result can be conveniently and accurately obtained through double-end query of the two groups of records, effective storage and query of the interval data are achieved, the storage space is saved, and the query efficiency is improved.
EXAMPLE III
On the basis of the above embodiments, the present embodiment describes in detail the implementation process of the interval data storage method by taking IP address interval data storage as an example. It should be noted that the embodiment of the present invention is not limited to be applied only to the case of storing IP address interval data, and the interval data storage method of the embodiment is applicable to the case of storing arbitrary interval data. The implementation process of the interval data storage method is as follows:
the section data to be stored is obtained, as shown in table 1, where the section data is a data range from a start IP to a termination IP, and taking the start IP as 0.0.0.10 and the termination IP as 0.0.0.20 as examples, the section data is 0.0.0.10, 0.0.0.11, 0.0.0.12, 0.0.0.13, 0.0.0.14, 0.0.0.15, 0.0.0.16, 0.0.0.17, 0.0.0.18, 0.0.0.19, 0.0.0.20, and the attribute values corresponding to the section data are all "a".
Initiating IP Terminating IP Value of
0.0.0.10 0.0.0.20 A
0.0.0.18 0.0.0.30 B
0.0.0.15 0.0.0.25 C
TABLE 1 Interval data
Determining the grading values of the initial IP and the terminal IP, expressing the initial IP and the terminal IP as a.b.c.d, setting the grading values as S, and setting the preset function relationship as S-2563*a+2562B +256 c + d to obtain the initial scoreValue and termination score value. For example, the initial IP is an initial score value S of 0.0.0.10 of 2563*0+25620+256 0+ 10-10, and a termination score S256 of 0.0.0.20 for termination IP3*0+25620+256 0+20 ═ 20. The subsequent starting IP and the subsequent ending IP are used for obtaining corresponding starting scoring values and ending scoring values in the same way, the starting scoring values and the ending IP values are used as scoring values of corresponding attributes of the starting IP and the ending IP, a Key value set is constructed by 'attribute values (scoring values'), elements in the Key value set are sorted according to the ascending of the scoring values to form a starting record and an ending record, and the starting record and the ending record are stored in a Key-value (score) form, as shown in table 2.
Key Value(Score)
IP start <A(10),C(15),B(18)>
IP end <A(20),C(25),B(30)>
Table 2 stored data
If the section data with the IP of 0.0.0.16 needs to be searched, the target IP is firstly converted into a target scoring value S of 2563*0+25620+256 0+16 ═ 16. Searching elements with the Score smaller than 16 in a key Value set corresponding to an IP start, forming a first attribute set, namely { A, C } by using attribute values of the searched elements, searching elements with the Score equal to or larger than 16 in the key Value set corresponding to an IP end, forming a second attribute set, namely { A, C, B } by using the attribute values of the searched elements, and removing the intersection of the first attribute set and the second attribute set to obtain the attribute values thereinNamely, the query result, i.e. a and C are query results, i.e. the attribute value corresponding to the interval data with IP of 0.0.0.16 is a and C.
The third embodiment of the invention provides a method for storing interval data, which comprises the steps of determining the initial value and the final value of each interval range according to the initial value and the final value of each interval range; according to the attribute values, the initial score values and the termination score values of all the interval ranges, initial records and termination records are respectively constructed in the database, interval data can be stored only by two groups of records without enumerating all key value pairs, effective storage of the interval data is achieved, and storage space is saved. And searching the starting record key value set and the ending record key value set according to the target score value to obtain a first attribute set and a second attribute set, and obtaining a query result by determining the intersection of the first attribute set and the second attribute set, so that the effective storage and query of the interval data are realized, and the query efficiency is improved.
Example four
Fig. 3 is a schematic structural diagram of an interval data storage device according to a fourth embodiment of the present invention. The device is suitable for storing interval data, can be realized by software and/or hardware, and can be specifically integrated in a server. Referring to fig. 3, the apparatus specifically includes:
a score determining module 410, configured to determine a start score value and an end score value of each interval range according to the start value and the end value of each interval range;
the building module 420 is configured to respectively build a start record and a stop record in the database according to the attribute value, the start score value, and the stop score value of each interval range.
Optionally, the building module 420 includes:
the first construction unit is used for taking the attribute values of all the interval ranges as elements in the initial record key value set and taking the initial score values associated with all the attribute values as the score values of all the attribute values in the initial record key value set;
and the second construction unit is used for taking the attribute value of each interval range as an element in the termination record key value set and taking the termination score value associated with each attribute value as the score value of each attribute value in the termination record key value set.
Optionally, the building module 420 further includes:
the first sequencing unit is used for sequencing all the attribute values in the initial record key value set according to the grading values of all the attribute values in the initial record key value set;
and the second sorting unit is used for sorting the attribute values in the termination record key value set according to the grading values of the attribute values in the termination record key value set.
Optionally, the method further includes:
the target score value determining module is used for determining a target score value of a target value to be queried;
the first searching module is used for searching attribute values with the score values smaller than the target score value from the initial record key value set to form a first attribute set;
the second searching module is used for searching attribute values with the score values equal to or larger than the target score value from the termination record key value set to form a second attribute set;
and the query module is used for determining the intersection of the first attribute set and the second attribute set and taking the attribute value in the intersection as a query result.
Optionally, the score determining module is specifically configured to: and determining the starting value and the ending value of each interval range according to the starting value and the ending value of each interval range based on a preset linear function.
According to the technical scheme of the embodiment, the initial score value and the termination score value of each interval range are determined through the score determining module according to the initial value and the termination value of each interval range, and the construction module respectively constructs the initial record and the termination record in the database according to the attribute value, the initial score value and the termination score value of each interval range. According to the technical scheme in the embodiment, the interval data can be stored only by two groups of records without enumerating all key value pairs, so that the interval data can be effectively stored, and the storage space is saved.
EXAMPLE five
Fig. 4 is a schematic structural diagram of a server according to a fifth embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary server 512 suitable for use in implementing embodiments of the present invention. The server 512 shown in fig. 4 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in FIG. 4, the server 512 is in the form of a general purpose computing device. Components of server 512 may include, but are not limited to: one or more processors or processing units 516, a system memory 528, and a bus 518 that couples the various system components including the system memory 528 and the processing unit 516.
Bus 518 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
The server 512 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by server 512 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 528 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)530 and/or cache memory 532. The server 512 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 535 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 518 through one or more data media interfaces. Memory 528 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 550 having a set (at least one) of program modules 552 may be stored, for instance, in memory 528, such program modules 552 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. The program modules 552 generally perform the functions and/or methodologies of the described embodiments of the invention.
The server 512 may also communicate with one or more external devices 515 (e.g., keyboard, pointing device, display 525, etc.), with one or more devices that enable a user to interact with the server 512, and/or with any devices (e.g., network card, modem, etc.) that enable the server 512 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 522. Also, the server 512 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 520. As shown, the network adapter 520 communicates with the other modules of the server 512 via the bus 518. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the server 512, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 516 executes various functional applications and data processing by running at least one of other programs in the plurality of programs stored in the system memory 528, for example, to implement a section data storage method provided by the embodiment of the present invention.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform an interval data storage method.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A method for interval data storage, the method comprising:
determining the initial value and the termination value of each interval range according to the initial value and the termination value of each interval range;
respectively constructing an initial record and an end record in a database according to the attribute value, the initial score value and the end score value of each interval range;
the method further comprises the following steps:
determining a target score value of a target value to be queried;
searching attribute values with the score values smaller than the target score value from the initial record key value set to form a first attribute set;
searching attribute values with the score values equal to or larger than the target score value from the termination record key value set to form a second attribute set;
and determining the intersection of the first attribute set and the second attribute set, and taking the attribute value in the intersection as a query result.
2. The method of claim 1, wherein constructing the start record and the end record in the database according to the attribute values, the start score value and the end score value of each interval range comprises:
taking the attribute values of all the interval ranges as elements in the initial record key value set, and taking the initial score values associated with all the attribute values as the score values of all the attribute values in the initial record key value set;
and taking the attribute value of each interval range as an element in the termination record key value set, and taking the termination score value associated with each attribute value as the score value of each attribute value in the termination record key value set.
3. The method of claim 2, wherein the initial record and the end record are respectively constructed in a database according to the attribute values, the initial score values and the end score values of the respective interval ranges, further comprising:
sorting the attribute values in the initial record key value set according to the grade values of the attribute values in the initial record key value set;
and sorting the attribute values in the termination record key value set according to the grading values of the attribute values in the termination record key value set.
4. The method of claim 1, wherein determining the start and end score values for each interval range based on the start and end values for each interval range comprises:
and determining the starting value and the ending value of each interval range according to the starting value and the ending value of each interval range based on a preset linear function.
5. An interval data storage apparatus, comprising:
the score determining module is used for determining the initial score value and the termination score value of each interval range according to the initial value and the termination value of each interval range;
the construction module is used for respectively constructing an initial record and a termination record in the database according to the attribute value, the initial score value and the termination score value of each interval range;
the device further comprises:
the target score value determining module is used for determining a target score value of a target value to be queried;
the first searching module is used for searching attribute values with the score values smaller than the target score value from the initial record key value set to form a first attribute set;
the second searching module is used for searching attribute values with the score values equal to or larger than the target score value from the termination record key value set to form a second attribute set;
and the query module is used for determining the intersection of the first attribute set and the second attribute set and taking the attribute value in the intersection as a query result.
6. The apparatus of claim 5, wherein the building block comprises:
the first construction unit is used for taking the attribute values of all the interval ranges as elements in the initial record key value set and taking the initial score values associated with all the attribute values as the score values of all the attribute values in the initial record key value set;
and the second construction unit is used for taking the attribute value of each interval range as an element in the termination record key value set and taking the termination score value associated with each attribute value as the score value of each attribute value in the termination record key value set.
7. The apparatus of claim 6, wherein the build module further comprises:
the first sequencing unit is used for sequencing all the attribute values in the initial record key value set according to the grading values of all the attribute values in the initial record key value set;
and the second sorting unit is used for sorting the attribute values in the termination record key value set according to the grading values of the attribute values in the termination record key value set.
8. A server, characterized in that the server comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a span data storage method as claimed in any one of claims 1-4.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a span data storage method according to any one of claims 1-4.
CN201811473550.XA 2018-12-04 2018-12-04 Interval data storage method, device, server and storage medium Active CN109542912B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811473550.XA CN109542912B (en) 2018-12-04 2018-12-04 Interval data storage method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811473550.XA CN109542912B (en) 2018-12-04 2018-12-04 Interval data storage method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN109542912A CN109542912A (en) 2019-03-29
CN109542912B true CN109542912B (en) 2020-10-30

Family

ID=65853563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811473550.XA Active CN109542912B (en) 2018-12-04 2018-12-04 Interval data storage method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN109542912B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177031B (en) * 2021-04-21 2023-08-01 北京人大金仓信息技术股份有限公司 Processing method and device for database shared cache, electronic equipment and medium
CN113590890B (en) * 2021-08-04 2024-03-26 拉卡拉支付股份有限公司 Information storage method, apparatus, electronic device, storage medium, and program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107479834A (en) * 2017-08-28 2017-12-15 北京智芯微电子科技有限公司 A kind of file memory method and device based on COS
CN108717448A (en) * 2018-05-18 2018-10-30 南京大学 A kind of range query filter method and key-value pair storage system towards key-value pair storage

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7512617B2 (en) * 2004-12-29 2009-03-31 Sap Aktiengesellschaft Interval tree for identifying intervals that intersect with a query interval
US7630969B2 (en) * 2006-08-25 2009-12-08 Sap Ag Indexing and searching for database records with defined validity intervals
CN106095952A (en) * 2016-06-15 2016-11-09 公安部第三研究所 In space-time unique based on key assignments cloud storage, magnanimity crosses car record method for quickly querying
CN107025615B (en) * 2017-04-26 2020-09-11 北京正保育才教育科技股份有限公司 Learning condition statistical method based on learning tracking model
CN107861916A (en) * 2017-11-10 2018-03-30 中国科学院计算技术研究所 A kind of method and apparatus for being used to perform nonlinear operation for neutral net
CN107908366A (en) * 2017-11-14 2018-04-13 郑州云海信息技术有限公司 A kind of intelligent data access method, apparatus and equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107479834A (en) * 2017-08-28 2017-12-15 北京智芯微电子科技有限公司 A kind of file memory method and device based on COS
CN108717448A (en) * 2018-05-18 2018-10-30 南京大学 A kind of range query filter method and key-value pair storage system towards key-value pair storage

Also Published As

Publication number Publication date
CN109542912A (en) 2019-03-29

Similar Documents

Publication Publication Date Title
CN110019218B (en) Data storage and query method and equipment
CN111258966A (en) Data deduplication method, device, equipment and storage medium
CN106407303A (en) Data storage method and apparatus, and data query method and apparatus
CN109241100B (en) Query method, device, equipment and storage medium
WO2022021710A1 (en) Data dump method and apparatus, device, and storage medium
CN109815241B (en) Data query method, device, equipment and storage medium
CN109542912B (en) Interval data storage method, device, server and storage medium
CN111694866A (en) Data searching and storing method, data searching system, data searching device, data searching equipment and data searching medium
CN113407785A (en) Data processing method and system based on distributed storage system
US10552394B2 (en) Data storage with improved efficiency
CN109033456B (en) Condition query method and device, electronic equipment and storage medium
CN110874366A (en) Data processing and query method and device
CN108549666A (en) A kind of sort method of tables of data, device, equipment and storage medium
CN112487025A (en) Data query method and device, electronic equipment and storage medium
CN109697234B (en) Multi-attribute information query method, device, server and medium for entity
CN111897837B (en) Data query method, device, equipment and medium
CN114547086B (en) Data processing method, device, equipment and computer readable storage medium
CN109101595B (en) Information query method, device, equipment and computer readable storage medium
CN111198917A (en) Data processing method, device, equipment and storage medium
CN111309988B (en) Character string retrieval method and device based on coding and electronic equipment
CN114064729A (en) Data retrieval method, device, equipment and storage medium
CN109086328B (en) Method and device for determining upper and lower position relation, server and storage medium
CN110888839A (en) Data storage and data search method and device
CN108984719B (en) Data deleting method and device based on column storage, server and storage medium
US20230214394A1 (en) Data search method and apparatus, electronic device and storage medium

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