CN108460048A - A kind of method and apparatus of inquiry unique value - Google Patents

A kind of method and apparatus of inquiry unique value Download PDF

Info

Publication number
CN108460048A
CN108460048A CN201710093382.0A CN201710093382A CN108460048A CN 108460048 A CN108460048 A CN 108460048A CN 201710093382 A CN201710093382 A CN 201710093382A CN 108460048 A CN108460048 A CN 108460048A
Authority
CN
China
Prior art keywords
node
value
record
leaf node
sparse row
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710093382.0A
Other languages
Chinese (zh)
Other versions
CN108460048B (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710093382.0A priority Critical patent/CN108460048B/en
Publication of CN108460048A publication Critical patent/CN108460048A/en
Application granted granted Critical
Publication of CN108460048B publication Critical patent/CN108460048B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees

Abstract

The purpose of the application is to provide a kind of method and apparatus of inquiry unique value, the application passes through the index tree that has created, the most value of the value of the sparse row of guide record in the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree, determine the value of current sparse row to be checked, and first searched successively in the leaf node belonging to the value of current sparse row to be checked guides record, it is described to guide the value for recording the storage location and the sparse row in the corresponding data that include data, it is described to guide value sequence from small to large of the record according to the sparse row, it is stored in each continuous leaf node of index tree successively;And the storage location of data in record is guided according to first found, obtain the corresponding data, unique value set is added in the value of sparse row in the data got, realizes based on the index tree, completes the quick obtaining of the unique value to the value of sparse row to be checked.

Description

A kind of method and apparatus of inquiry unique value
Technical field
This application involves computer realm more particularly to a kind of method and apparatus of inquiry unique value
Background technology
Sparse row refer to that there are many total record data belonging to sparse row, but are worth few row, for example, some environmental sanitation There are 1000 vehicles in company, if there may be the record data of 100,000 driving traces daily for each car, wherein these record data In there are one row storage be vehicle car plate, then in total 100,000,000 record, the value arranged belonging to car plate actually only has 1000 It is a.Unique value is used to indicate in a table, the value number of certain row, such as is exactly in the unique value of the sparse row (car plate) This 1000 car plates.
In the prior art, since the record data belonging to sparse row are stored in the heap table for clapping news without rule, if needing to count The unique value of sparse row is calculated, then needs to scan full table, sparse row are ranked up, the repetition values of sparse row is then removed, obtains The number of the unique value of sparse row.Such as it as shown in Figure 1, is stored in all 1 hundred million record data of the above-mentioned vehicle in one day How many in heap table, when need to calculate a car and turned out for work, then need to be ranked up above-mentioned 100,000,000 record data, so Record data belonging to the repetition values of the corresponding car plate of removal vehicle afterwards, the record data belonging to the corresponding car plate of each vehicle are only Leaving one, then the sum of the corresponding car plate of the vehicle being calculated can obtain the number of the unique value of car plate (sparse row), Lead to that the resource overhead of whole process is very big and efficiency is low.Further, the prior art is also using index, to needing to calculate only The sparse row of one value create index tree, since index therefore need not be sorted to the data organization after the sequence of sparse row Process, and since database is to support concurrent access, recording data daily has version information but the no version information of index, All leaf nodes in scanning index tree are needed, then duplicate removal, and counts the record data belonging to the unique value of sparse row Item number, leads to the heavy workload for searching the unique value of sparse row and efficiency is low, and then can not rapidly obtain the unique of sparse row Value.
Invention content
The purpose of the application is to provide a kind of method and apparatus of inquiry unique value, and solution is searched only in the prior art The problem that operating point amount is big caused by one value and efficiency is low.
According to the one side of the application, a kind of storage method of the data containing sparse row is provided, this method includes:
The value for obtaining the storage location and the sparse row in the corresponding data of data, by the storage location of data and right The value of sparse row in the data answered is recorded as guide;
According to the value sequence from small to large of the sparse row, record is guided to be sequentially stored into each continuous of index tree by described Leaf node;
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record.
Further, in the above method, the described upper layer node that recorded in the upper layer node of the leaf node is wrapped The most value of the value of the leaf node contained and the sparse row that record is guided in the leaf node, including:
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The maximum value or minimum value of the value of the sparse row of middle guide record.
Further, in the above method, the upper layer node includes the last layer root node of the leaf node,
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record, including:
It is recorded in the root node sparse in the guide record in the leaf node and the leaf node that it is included The most value of the value of row.
Further, in the above method, the upper layer node includes last layer branch node and the institute of the leaf node The last layer root node of branch node is stated,
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record, including:
The leaf node and the leaf node that it is included are recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of middle guide record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
Further, in the above method, the upper layer node includes root node, in the root node and leaf node it Between multilayer branch node,
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record, including:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node Most value, or record in branch node the sparse row in the next layer of branch node and the next layer of branch node that it is included Value most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
According to further aspect of the application, a kind of method of inquiry unique value is provided, this method includes:
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, determine the value of current sparse row to be checked;
It searches first belonging to the value of current sparse row to be checked successively in the leaf node and guides record, In, it is described to guide the value for recording the storage location and the sparse row in the corresponding data that include data, the guide record According to the value sequence from small to large of the sparse row, it is stored in each continuous leaf node of index tree successively;
The storage location of data in record is guided to obtain the data according to first found, described in getting Unique value set is added in the value of sparse row in data.
Further, in the above method, the data are obtained according to the storage location of data in the guide record found Later, further include:
If having not been obtained, current sparse row to be checked are searched successively in the leaf node of current queries or follow-up leaf node Value belonging to next guide record;
The storage location of the data in record is guided to obtain the data according to next found, it, will if getting Unique value set is added in the value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will obtain Unique value set is added in the value of sparse row in the data got, or until dilute in the next guide record inquired The value for dredging row is different from the value of current sparse row to be checked.
Further, in the above method, if what is recorded in upper layer node in index tree is that the upper layer node is included The minimum value of the value of the sparse row of guide record in leaf node and the leaf node,
Determine the value of current sparse row to be checked, including:
In all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Small value starts, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
Further, in the above method, if what is recorded in upper layer node in index tree is that the upper layer node is included The maximum value of the value of the sparse row of guide record in leaf node and the leaf node,
Determine the value of current sparse row to be checked, including:
In all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Big value starts, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
Further, in the above method, the upper layer node includes the last layer root node of the leaf node,
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, including:
According to the guide note in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of the sparse row of record.
Further, in the above method, the upper layer node includes last layer branch node and the institute of the leaf node The last layer root node of branch node is stated,
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, including:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to its leaf node for being included and the leaf recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in child node.
Further, in the above method, the upper layer node includes root node, in the root node and leaf node it Between multilayer branch node,
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, including:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to recording next layer of branch node that the branch node is included and next layer of branch's section in branch node The most value of the value of sparse row in point;
Finally the sparse of record is guided according to being recorded in branch node in the leaf node and the leaf node that it is included The most value of the value of row.
According to further aspect of the application, a kind of storage device of the data containing sparse row is provided, wherein described Equipment includes:
The value of acquisition device, the storage location for obtaining data and the sparse row in the corresponding data, by data Storage location and the sparse row in the corresponding data value as guide record;
Guide record is sequentially stored by storage device for the sequence of the value according to the sparse row from small to large Each continuous leaf node of index tree;
Recording device, the leaf node for being included for recording the upper layer node in the upper layer node of the leaf node And the most value of the value of the sparse row of record is guided in the leaf node.
Further, in above equipment, the recording device is used for:
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The maximum value or minimum value of the value of the sparse row of middle guide record.
Further, in above equipment, the upper layer node includes the last layer root node of the leaf node,
The recording device is used for:
It is recorded in the root node sparse in the guide record in the leaf node and the leaf node that it is included The most value of the value of row.
Further, in above equipment, the upper layer node includes last layer branch node and the institute of the leaf node The last layer root node of branch node is stated,
The recording device is used for:
The leaf node and the leaf node that it is included are recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of middle guide record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
Further, in above equipment, the upper layer node includes root node, in the root node and leaf node it Between multilayer branch node,
The recording device is used for:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node Most value, or record in branch node the sparse row in the next layer of branch node and the next layer of branch node that it is included Value most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
According to further aspect of the application, a kind of equipment of inquiry unique value is provided, wherein the equipment includes:
It determines and searches device, the leaf for being included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of guide record in node and the leaf node,
The value for determining current sparse row to be checked searches current sparse row to be checked successively in the leaf node Value belonging to first guide record, wherein it includes the storage location of data and the corresponding data that guides, which records, In sparse row value, it is described to guide value sequence from small to large of the record according to the sparse row, be stored in index tree successively Each continuous leaf node;
Unique value statistic device, for being guided according to first found described in the storage location acquisition of data in record Unique value set is added in the value of sparse row in the data got by data.
Further, in above equipment, the unique value statistic device is additionally operable to:
If having not been obtained, current sparse row to be checked are searched successively in the leaf node of current queries or follow-up leaf node Value belonging to next guide record;
The storage location of the data in record is guided to obtain the data according to next found, it, will if getting Unique value set is added in the value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will obtain Unique value set is added in the value of sparse row in the data got, or until dilute in the next guide record inquired The value for dredging row is different from the value of current sparse row to be checked.
Further, in above equipment, if what is recorded in upper layer node in index tree is that the upper layer node is included The minimum value of the value of the sparse row of guide record in leaf node and the leaf node,
The determining device of searching is used for:
In all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Small value starts, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
Further, in above equipment, if what is recorded in upper layer node in index tree is that the upper layer node is included The maximum value of the value of the sparse row of guide record in leaf node and the leaf node,
The determining device of searching is used for:
In all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Big value starts, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
Further, in above equipment, the upper layer node includes the last layer root node of the leaf node,
The determining device of searching is used for:
According to the guide note in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of the sparse row of record.
Further, in above equipment, the upper layer node includes last layer branch node and the institute of the leaf node The last layer root node of branch node is stated,
The determining device of searching is used for:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to its leaf node for being included and the leaf recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in child node.
Further, in above equipment, the upper layer node includes root node, in the root node and leaf node it Between multilayer branch node,
The determining device of searching is used for:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to recording next layer of branch node that the branch node is included and next layer of branch's section in branch node The most value of the value of sparse row in point;
Finally the sparse of record is guided according to being recorded in branch node in the leaf node and the leaf node that it is included The most value of the value of row.
According to further aspect of the application, a kind of equipment based on calculating is provided, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed Manage device:
The value for obtaining the storage location and the sparse row in the corresponding data of data, by the storage location of data and right The value of sparse row in the data answered is recorded as guide;
According to the value sequence from small to large of the sparse row, record is guided to be sequentially stored into each continuous of index tree by described Leaf node;
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record.
According to further aspect of the application, a kind of equipment based on calculating is provided, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed Manage device:
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, determine the value of current sparse row to be checked;
It searches first belonging to the value of current sparse row to be checked successively in the leaf node and guides record, In, it is described to guide the value for recording the storage location and the sparse row in the corresponding data that include data, the guide record According to the value sequence from small to large of the sparse row, it is stored in each continuous leaf node of index tree successively;
The storage location of data in record is guided to obtain the data according to first found, described in getting Unique value set is added in the value of sparse row in data.
Compared with prior art, the application passes through elder generation in a kind of storage method of data containing sparse row of offer The value for obtaining the storage location and the sparse row in the corresponding data of the data recorded in heap table, by the storage position of the data It sets with the value of the sparse row in the corresponding data as guide record;According to value from big to small suitable of the sparse row Guide record is sequentially stored into each continuous leaf node of index tree by sequence;And it is saved on the upper layer of the leaf node The most value of the value for the sparse row that record is guided in the leaf node and the leaf node that the upper layer node is included is recorded in point, no It only realizes and index tree is created to sparse row, subsequently rapidly to get the unique value for the value that need to count sparse row, will also The storage location of the value of sparse row in heap table and its affiliated data respectively connects as guide record write-in index tree In continuous leaf node, subsequently to be found belonging to the value of the sparse row from the storage location in the guide record in leaf node Data.
Further, the application is also in a kind of method of inquiry unique value of offer, by the index tree created, Guide in the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record, determines the value of current sparse row to be checked, and is searched successively in the leaf node First belonging to the value of current sparse row to be checked is guided record, wherein the guide record includes the storage position of data Set the value with the sparse row in the corresponding data, it is described to guide value from small to large suitable of the record according to the sparse row Sequence is stored in each continuous leaf node of index tree successively;And the storage of data in record is guided according to first found Position obtains the corresponding data, and unique value set is added in the value of the sparse row in the data got, is realized Based on the index tree, the quick obtaining of the unique value to the value of sparse row to be checked is completed.
Description of the drawings
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 shows a kind of method flow diagram of inquiry unique value of existing scheme;
Fig. 2 shows the wounds of index tree in the storage method according to a kind of data containing sparse row of the application one side Build flow chart;
Fig. 3 shows index tree in the storage method according to a kind of data containing sparse row of the application other side Visioning procedure figure;
Fig. 4 shows index tree in the storage method according to a kind of data containing sparse row of the application other side Visioning procedure figure;
Fig. 5 is shown in a kind of inquiry unique value method according to the application one side from the minimum value of the value of sparse row The flow chart that starts a query at of minimum value;
Fig. 6 is shown in a kind of inquiry unique value method according to the application one side from the maximum value of the value of sparse row The flow chart that starts a query at of maximum value;
Fig. 7 is shown in a kind of inquiry unique value method according to the application one side from the minimum value of the value of sparse row The first time querying flow figure that starts a query at of minimum value;
Fig. 8 is shown in a kind of inquiry unique value method according to the application one side from the minimum value of the value of sparse row Second of querying flow figure starting a query at of minimum value;
Fig. 9 shows a kind of storage device of data containing sparse row according to the application one side;
The equipment that Figure 10 shows a kind of inquiry unique value according to the application other side.
Same or analogous reference numeral represents same or analogous component in attached drawing.
Specific implementation mode
The application is described in further detail below in conjunction with the accompanying drawings.
In a typical configuration of this application, terminal, the equipment of service network and trusted party include one or more Processor (CPU), input/output interface, network interface and memory.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology realizes information storage.Information can be computer-readable instruction, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM), Digital versatile disc (DVD) or other optical storages, magnetic tape cassette, magnetic tape disk storage or other magnetic storage apparatus or Any other non-transmission medium can be used for storage and can be accessed by a computing device information.As defined in this article, computer Readable medium does not include non-temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
According to a kind of storage method of data containing sparse row of the application one side, it is corresponding to be applied to database Server end, the method comprising the steps of S11, step S12 and step S13, wherein obtain recorded in the heap table in database first All data, the value of the storage location and the sparse row in the corresponding data of each data is obtained in the step S11, and The value of sparse row in the storage location and the corresponding data of the data of each record is guided into record as one, is obtained The guide record of the value of sparse row in the corresponding data of the storage locations of each data, and by all guide records according to The sequence of the value of the sparse row from small to large is sequentially stored into each continuous leaf node (leaf page) (example of index tree Such as, leaf node 1, leaf node 2, leaf node 3 ..., leaf node m);And in the corresponding upper layer node of each leaf node Most value (the example of the middle value for recording the sparse row that record is guided in the leaf node and its leaf node that the upper layer node is included Such as, recorded in the upper layer node of leaf node 1 leaf node 1,2 that upper layer node included ..., in m and leaf node 1 The value for the sparse row that all guides record in most value, the leaf node 2 of the value of the sparse row of all guide records is most Value ... and the most value of the value of the sparse row of guide record all in leaf node m), it not only realizes and sparse row is created Index tree, subsequently rapidly to get the unique value for the value that need to count sparse row, also by the value of the sparse row in heap table and The storage location of the data belonging to it is as guiding in each continuous leaf node of record write-in index tree, with after an action of the bowels Storage location in the continuous guide record from leaf node finds the data belonging to the value of the sparse row.
The index tree of the application further includes metadata node, wherein is stored in the metadata node (meta page) It is specific location of the root node (root page) in index tree in index tree, quickly to find under the index tree Root node, meanwhile, before creating index tree, the number of plies of the also preset index that need to be created of the metadata node and corresponding each layer The number of nodes of node is preset and the corresponding quantity for recording result of node is preset, for example, the preset establishment in metadata node Index tree includes root node and leaf node, including 4 leaf nodes and each leaf node store up to 4 and guide record, And then management of the realization to index tree.
It should be noted that the data are in the heap table deposited in the database, wherein the data in heap table are that do not have There is storage order, it can be with to add memory space as unit of data block at end of file in heap table, in each data block At least one data are recorded, with the continuous renewal of the data in heap table, deletion etc., some data blocks can discharge memory space, The data that the needs being then newly inserted into record then randomly are stored in the heap table corresponding data block of free remaining memory space.
The leaf node in the embodiment of the present application is the bottom of the index tree, wherein in the leaf node not only The storage location ROWID (such as data block ID+ line numbers in heap table) for storing the data in heap table, is also stored the data In guide record in sparse row value, such as leaf node 1 includes sparse row 1, sparse row 2, then has in leaf node Guide be recorded as (guide record 1:The value1 of sparse row 1, storage location ROWID1), (guide record 2:Sparse row 2 Value1, storage location ROWID3) and (guide record 3:The value2 of sparse row 1, storage location ROWID2) }.
Further, the step S13 includes:The upper layer node is recorded in the upper layer node of the leaf node to be wrapped The maximum value or minimum value of the value of the leaf node contained and the sparse row that record is guided in the leaf node.If for example, sparse row It is respectively leaf node 1 and leaf node 2 there are two leaf node, wherein the finger that leaf node 1 includes for the car plate of vehicle Draw and is recorded as { guide 1 (car plate 1, storage location ROWID1) of record and guide 1 (car plate 2, storage location ROWID9) of record }, leaf The guide that child node 2 includes is recorded as that { guiding 1 (car plate 3, storage location ROWID14) of record and guiding to record, 1 (car plate 4, is deposited Storage space sets ROWID23) }, then there is the car plate that leaf node 1 and its middle guide record are recorded in the upper layer node of leaf node The minimum value of value:The minimum value of the value of the car plate of car plate 1 and leaf node 2 and its middle guide record:Car plate 3;Or in leaf section The maximum value of the value of the car plate of record leaf node 2 and its middle guide record in the upper layer node of point:Car plate 2 and leaf node 2 And its maximum value of the value of the car plate of middle guide record:Car plate 4 realizes and remembers all guides recorded in each leaf node Most value in the value of sparse row in record is extracted in upper layer node, so as to the most value of the value subsequently based on sparse row and corresponding Leaf node finds the data belonging to the value of the sparse row, and then can rapidly get the unique value of sparse row.
Further, when the data recorded in heap table are less, the upper layer node that the index tree includes is the leaf The last layer root node of node, the i.e. top layer of the index tree are root node, which further includes undermost leaf node, When the data recorded in heap table are less, the index tree includes root node and leaf node;Then the step S13 is in institute It states to record in the upper layer node of leaf node and guides record in the leaf node and the leaf node that the upper layer node is included The most value of the value of sparse row, including:The finger in the leaf node and the leaf node that it is included is recorded in the root node Draw the most value of the value of the sparse row in record.
In one embodiment of the application, as shown in Fig. 2, record has 16 datas in heap table, by the storage position of each data It sets and the value of sparse row therein makees that record is guided to be stored respectively in leaf node 1, leaf node 2, leaf section in index tree In point 3 and leaf node 4, then there is having for the write-in of leaf node 1:{ guide record 1:(car plate 1,1 line number 1 of data block) guides note Record 2:(car plate 1,2 line number 1 of data block) guides record 3:(car plate 1,3 line number 1 of data block) and guide record 4:(car plate 2, number According to 1 line number 2 of block) }, what is be written in leaf node 2 has:{ guide record 5:(car plate 2,1 line number 3 of data block) guides record 6: (car plate 2,3 line number 2 of data block) guides record 7:(car plate 3,2 line number 4 of data block) and guide record 8:(car plate 3, data block 3 Line number 3) }, what is be written in leaf node 3 has:{ guide record 9:(car plate 3,4 line number 1 of data block) guides record 10:(car plate 4,1 line number 4 of data block), guide record 11:(car plate 4,3 line number 4 of data block) and guide record 12:(car plate 4,4 row of data block Number 3) what is } and in leaf node 4 be written has:{ guide record 13:(car plate 5,2 line number 3 of data block) guides record 14:(vehicle Board 5,4 line number 2 of data block), guide record 15:(car plate 6,2 line number 2 of data block) and guide record 16:(car plate 6, data block 4 Line number 4) }, then the step S13 records leaf node 1 that it is included to leaf node 4 and each leaf in the root node The minimum value of the value of the sparse row in guide record in child node, then have in root node and be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf node 5) }, it realizes containing in heap table There is the guide record of all data of sparse row to be written in each continuous leaf node, and realizing will be in each leaf node It guides in the leaf node at the minimum value in the value of the sparse row of record and its place deposit root node, to be subsequently based on record Sparse row value in minimum value and its leaf node at place rapidly obtain the value and its correspondence of sparse row to be checked The effective data recorded in heap table, and then reduce searching work amount and improve the working efficiency of lookup.
In another embodiment of the application, if as shown in figure 3, record has 16 datas in heap table, by each data Storage location and the value of sparse row therein make to guide record be stored respectively in the leaf node 1 in index tree, leaf node 2, In leaf node 3 and leaf node 4, then there is having for the write-in of leaf node 1:{ guide record 1:(car plate 1,1 line number 1 of data block), Guide record 2:(car plate 1,2 line number 1 of data block) guides record 3:(car plate 1,3 line number 1 of data block) and guide record 4:(vehicle Board 2,1 line number 2 of data block) }, what is be written in leaf node 2 has:{ guide record 5:(car plate 2,1 line number 3 of data block) guides note Record 6:(car plate 2,3 line number 2 of data block) guides record 7:(car plate 3,2 line number 4 of data block) and guide record 8:(car plate 3, number According to 3 line number 3 of block) }, what is be written in leaf node 3 has:{ guide record 9:(car plate 3,4 line number 1 of data block) guides record 10: (car plate 4,1 line number 4 of data block) guides record 11:(car plate 4,3 line number 4 of data block) and guide record 12:(car plate 4, data 4 line number 3 of block) } and leaf node 4 in be written have:{ guide record 13:(car plate 5,2 line number 3 of data block) guides record 14:(car plate 5,4 line number 2 of data block) guides record 15:(car plate 6,2 line number 2 of data block) and guide record 16:(car plate 6, number According to 4 line number 4 of block) }, then the step S13 records leaf node 1 that it is included to leaf node 4 in the root node And the maximum value of the value of the sparse row in the guide record in each leaf node, then have in root node and is recorded as { (car plate 2:Leaf Child node 1), (car plate 3:Leaf node 2), (car plate 4:Leaf node 3) and (car plate 6:Leaf node 4) }, it realizes heap table In the guide records of all data containing sparse row be written in each continuous leaf node, and realize each leaf section In the leaf node deposit root node of maximum value and its place in the value of the sparse row of guide record in point, so as to follow-up base The leaf node of maximum value and its place in the value of the sparse row of record rapidly obtain sparse row to be checked value and Its corresponding effective data recorded in heap table, and then reduce searching work amount and improve the working efficiency of lookup.
Further, when the data recorded in heap table are more, the upper layer node that the index tree includes includes the leaf The last layer branch node of child node and the last layer root node of the branch node, the i.e. top layer of the index tree are root section Point, middle layer are one layer of branch node, which further includes undermost leaf node, i.e., the data recorded in heap table compared with When more, the index tree includes root node, one layer of branch node and leaf node;Then the step S13 is in the leaf The sparse row that record is guided in the leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of node Value most value, including:
The leaf node and the leaf node that it is included are recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of middle guide record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
It selects below so that the most value is minimum value as an example, carrying out embodiment in detail to the step S13 explains.Exist In the embodiment of the application, as shown in figure 4, record has n × n × n datas in heap table, in metadata node (meta Page it includes root node (root page), one layer of branch node (branch page) and leaf node that the index tree is preset in) (leaf page), wherein default individual node can store n items guide record, then index tree herein can store n × n × N items guide record, are preset with n branch node, include n leaf node and each leaf node under each branch node The corresponding n items that can store up to guide record, obtain by sparse row (car plate of vehicle) since car plate 1, by car plate 1 in heap Attendance record in table successively writes the guide of the corresponding car plate 1 of the storage location of each data record according to sequence of turning out for work Enter branch's leaf node 1, after leaf and node 1 write n datas, will 1 corresponding guide of car plate be recorded into write-in leaf successively It in child node 2, writes after car plate 1 corresponds to the data that are recorded in heap table, then records guides corresponding with car plate 2 by turning out for work It is sequentially written in leaf node 2 and subsequent leaf node, in this way, by 1000 corresponding attendance records in heap table of car plate Data be written in each continuous leaf node in the form of guide;Then last layers of the step S13 in leaf node Branch node in record the sparse row that record is guided in the leaf node and the leaf node that it is included value minimum value, As record has the minimum value car plate 1 and corresponding leaf node 1, car plate 1 and corresponding of sparse row in the branch node 1 in Fig. 4 Leaf node 2, car plate 1 and corresponding leaf node 3 ... and car plate 1 and corresponding leaf node n;In branch node 2 Record has minimum value car plate 1 and its corresponding leaf node n+1, the car plate 2 and its corresponding leaf node n+2, vehicle of sparse row Board 2 and its corresponding leaf node n+3 ..., car plate 2 and its corresponding leaf node m ... ..., successively by each leaf section The minimum value and corresponding leaf node that the value of the sparse row (car plate of vehicle) of record is guided in point are corresponded to as a record The corresponding last layer of write-in branch node;Then, root node record the next layer of branch node that it is included and this under The minimum value of the value of sparse row in one layer of branch node, as record has the minimum value of each branch node in the root node in Fig. 4 And its corresponding branch node:Car plate 1:Branch node 1, car plate 1:Branch node 2, car plate 3:Branch node 3 ... ..., car plate 1000:Branch node n realizes all data in the case of the more data that will be recorded in heap table to guide record Form is mapped respectively in write-in to each continuous leaf node in index tree, and is realized the guide in each leaf node The leaf node of minimum value and its place in the value of the sparse row of record is stored in corresponding branch node, and each branch is saved Minimum value and its corresponding branch node in the value of sparse row in point are written as a record in corresponding root node, with Continue the branch node of minimum value and its place in the value based on the sparse row recorded in root node and next layer corresponding after an action of the bowels The minimum value of the sparse row of branch node record and its corresponding leaf node, and then rapidly obtain sparse row to be checked Value and its corresponding effective data recorded in heap table, and then reduce searching work amount and improve the working efficiency of lookup.
Further, when there are many data recorded in heap table, the upper layer node that the index tree includes includes root node, Multilayer branch node between the root node and leaf node, the index tree further include undermost leaf node, i.e., When there are many data recorded in heap table, the index tree includes root node, multilayer branch node and leaf node;Then institute It states step S13 and records the leaf node and the leaf node that the upper layer node is included in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record, including:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node Most value, or record in branch node the sparse row in the next layer of branch node and the next layer of branch node that it is included Value most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
For to select the number of plies by the most value for minimum value and the branch node below be 2 layers, to the step S13 Embodiment in detail is carried out to explain.I.e. in the embodiment of the application, record has n × n × n × n datas in heap table, It includes root node (root page), first layer branch node (first that the index tree is preset in metadata node (meta page) Branch page), second layer branch node (second branch page) and leaf node (leaf page), wherein it is pre- If individual node can store n items and guide record, then index tree herein can store n × n × n × n items and guide record, preset Every layer of branch node has n, includes n leaf node under each branch node, and each leaf node is corresponding can be with It stores up to n items and guides record, obtain by sparse row (car plate of vehicle) since car plate 1, by the turning out for work in heap table of car plate 1 The guide of the corresponding car plate 1 of the storage location of each data is recorded write-in branch leaf by record successively according to sequence of turning out for work Node 1 will successively record 1 corresponding guide of car plate in write-in leaf node 2 after leaf and node 1 write n datas, After writing the data that the correspondence of car plate 1 records in heap table, guide record corresponding with car plate 2 is then sequentially written in leaf by turning out for work In child node 2 and subsequent leaf node, in this way, by the data of 1000 corresponding attendance records in heap table of car plate with The form of guide is written in each continuous leaf node;Then the branch node of last layers of the step S13 in leaf node The minimum value of the middle value for recording the sparse row that record is guided in the leaf node and the leaf node that it is included, in the second layer point Record has minimum value car plate 1 and corresponding leaf node 1, the car plate 1 and corresponding leaf node 2, vehicle of sparse row in Zhi Jiedian 1 Board 1 and corresponding leaf node 3 ... and car plate 1 and corresponding leaf node n;There is record in second layer branch node 2 The minimum value car plate 1 of sparse row and its corresponding leaf node n+1, car plate 2 and its corresponding leaf node n+2, car plate 2 and its Corresponding leaf node n+3 ..., car plate 2 and its corresponding leaf node m ... ..., will be guided in each leaf node successively The minimum value of the value of the sparse row (car plate of vehicle) of record and corresponding leaf node record corresponding write-in pair as one The second layer branch node for the last layer answered;Then, each second layer branch of corresponding lower layer is recorded in first layer branch node 1 The minimum value of node and its corresponding sparse row (car plate);Then, its first layer branch node for being included is recorded in root node And the minimum value of the value of the sparse row in the first layer branch node, record has each first layer branch node most in root node Small value and its corresponding first layer branch node:Car plate 1:First layer branch node 1, car plate 1:First layer branch node 2, car plate 3:First layer branch node 3 ... ..., car plate 1000:First layer branch node n realizes the more number that will be recorded in heap table Mapping is written to each continuous leaf section in index tree all data in the case of respectively in the form of guiding record In point, and realize the leaf section of minimum value and its place in the value of the sparse row of the guide record in each leaf node Point is stored in corresponding second layer branch node, and by the value of the sparse row in each second layer branch node minimum value and its Corresponding second layer branch node is written as a record in corresponding first layer branch node, finally saves first layer branch Minimum value and its corresponding first layer branch node in the value of sparse row in point is as corresponding section of a record write-in In point, so as under the branch node and correspondence of minimum value and its place in the value subsequently based on the sparse row recorded in root node The minimum value and its corresponding second layer branch node and corresponding next of the sparse row of one layer of first layer branch node record The minimum value of the sparse row of the second layer branch node record of layer and its corresponding leaf node, and then rapidly obtain to be checked Sparse row value and its corresponding effective data recorded in heap table, and then reduce and searching work amount and improve lookup Working efficiency.
According to a kind of method of inquiry unique value of the application other side, it is applied to the corresponding server of database End, the method comprising the steps of S21 and step S22, wherein this method by the index tree that has created, the step S21 according to Guide record in leaf node and the leaf node that the upper layer node recorded in upper layer node in index tree is included Sparse row value most value, determine the value of current sparse row to be checked;Then in the step S21, in the leaf First belonging to the value of current sparse row to be checked is searched in node successively and guides record, wherein the guide record packet Include the value of the storage location and the sparse row in the corresponding data of data, the value for guiding record according to the sparse row Sequence from small to large is stored in each continuous leaf node of index tree successively;The last step S22 is according to the found One is guided the storage location of data in record to obtain the data, and the value of the sparse row in the data got is added Unique value set realizes based on the index tree, completes the quick obtaining of the unique value to the value of sparse row to be checked, avoid Whole leaf nodes in index tree are scanned, also avoid scanning guide in all leaf nodes record it is corresponding The scanning of the storage location of data, as long as corresponding first guide of the value for getting sparse row to be checked is recorded in heap table When corresponding data, then upper layer node is may return to, continues to search for next value of the value of sparse row to be checked, such lookup side Formula not only reduces the workload of scanning index tree, also greatly improves the work of the unique value for the value for searching sparse row to be checked Make efficiency.
Further, the number is obtained according to the storage location of data in the guide record found in the step S22 According to later, further include:
If having not been obtained, current sparse row to be checked are searched successively in the leaf node of current queries or follow-up leaf node Value belonging to next guide record;
The storage location of the data in record is guided to obtain the data according to next found, it, will if getting Unique value set is added in the value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will obtain Unique value set is added in the value of sparse row in the data got, or until dilute in the next guide record inquired The value for dredging row is different from the value of current sparse row to be checked.
In one embodiment of the application, if being searched in the step S21 belonging to the value (car plate 1) of current sparse row to be checked First guide record when, the step S22 is according to the current sparse row to be checked found in leaf node It is worth first belonging to (car plate 1) storage location guided in record, the corresponding data is got in heap table, then should Unique value set { car plate 1 } is added in the value of sparse row in the data got;If according in leaf section in the step S22 First storage location guided in record belonging to the value (car plate 1) of the current sparse row to be checked found in point, does not exist Corresponding data are got in heap table, then in the leaf node of current queries (for example, the value (car plate of current sparse row to be checked 1) next belonging to is guided first belonging to the value (car plate 1) of record and current sparse row to be checked to guide record in same In one leaf node) or follow-up leaf node (for example, next guide belonging to the value (car plate 1) of current sparse row to be checked First belonging to the value (car plate 1) of record and current sparse row to be checked is guided record to be in adjacent different leaf nodes In) search successively belonging to the value of current sparse row to be checked next guide record.
Then above-described embodiment of the application, the belonging to the value (car plate 1) according to the current sparse row to be checked of inquiry One is guided record after obtaining corresponding data failure in heap table, to be guided in record then according to next found The storage location of data obtains the data in heap table, if getting, unique value collection is added in the value containing sparse row It closes { car plate 1 }, if if having not been obtained, repeating belonging to the above-mentioned value (car plate 1) for inquiring current sparse row to be checked successively Next the step of guiding record, until getting corresponding data in heap table (for example, current sparse row to be checked Being worth former belonging to (car plate 1) guides the storage location correspondence of the data in record that corresponding data are not present in heap table, I.e. data have failed, and the subsequent a certain item belonging to the value (car plate 1) of current sparse row to be checked guides the number in record According to storage location correspond to data in heap table and effectively exist in), then by the value of the sparse row in the data got Unique value set { car plate 1 } is added, by above-mentioned repetitive cycling step, reduces to upper layer node and its corresponding leaf section The scanning of point, and then the workload of the unique value for the value for searching sparse row to be checked is greatly reduced, also improve lookup Working efficiency.
Further, if recorded in upper layer node in index tree be leaf node that the upper layer node is included and should The minimum value of the value of the sparse row of guide record in leaf node,
The step S21 determines the value of current sparse row to be checked, including:
In all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Small value starts, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
In one embodiment of the application, as shown in figure 5, what is recorded in upper layer node (root node) in index tree is on this The minimum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };The step S21 is according to the minimum value in all minimum values of the value of the sparse row recorded in upper layer node (root node) (car plate 1) starts, and the grey parts in scanning figure 5 obtain the value car plate 1 of sparse row, then according to sequence from small to large, according to The value of the secondary sparse row by the guide record in leaf node:Car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 are used as and currently wait for The value of the sparse row of inquiry is realized the index of the value of sparse row to be checked, so that the sparse row to be checked obtained Value unique value set it is more accurate.
Further, if recorded in upper layer node in index tree be leaf node that the upper layer node is included and should The maximum value of the value of the sparse row of guide record in leaf node,
Determine the value of current sparse row to be checked, including:
In all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Big value starts, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
In one embodiment of the application, as shown in fig. 6, what is recorded in upper layer node (root node) in index tree is on this The maximum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };The step S21 is according to the maximum value in all maximum values of the value of the sparse row recorded in upper layer node (root node) (car plate 6) starts, and the grey parts in scanning figure 6 obtain the value car plate 6 of sparse row to be checked, then according to from big to small Sequence, successively by leaf node guide record sparse row value:Car plate 6, car plate 5, car plate 4, car plate 3 and car plate 2 It as the value of current sparse row to be checked, realizes the index of the value of sparse row to be checked, so that is obtained is to be checked Unique value set of the value for the sparse row ask is more accurate.
Further, the upper layer node includes the last layer root node of the leaf node,
The leaf section for being included according to the upper layer node recorded in the upper layer node in index tree in the step S21 The most value of the value of the sparse row of guide record in point and the leaf node, including:
According to the guide note in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of the sparse row of record.
Below with according in its leaf node for being included and the leaf node recorded in the root node in index tree It guides for the minimum value of the value of the sparse row of record, the step S21 and step S22 is illustrated.
In one embodiment of the application, as shown in figure 5, what is recorded in upper layer node (root node) in index tree is on this The minimum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };The step S21 is according to the minimum value in all minimum values of the value of the sparse row recorded in upper layer node (root node) (car plate 1) starts, according to sequence from small to large, successively by the value of the sparse row of the guide record in leaf node:Car plate 1, The value of car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 as current sparse row to be checked.As the general in the step S22 When car plate 1 is as the currently value of sparse row to be checked, based on the 1 corresponding leaf node 1 of car plate recorded in root node, in leaf Lookup includes first guide record of car plate 1 in child node 1, obtains { guiding record 1:(car plate 1,1 line number of data block 1) storage location { 1 line number 1 of data block } }, being then based in guide record 1 obtains the number belonging to the car plate 1 in heap table According to if { 1 line number 1 of data block } in heap table gets the data belonging to the car plate 1, by the value of the sparse row in the data (car plate 1) is added in unique value set;It is then back to value of the root node by car plate 2 as current sparse row to be checked, is repeated Above-mentioned steps obtain that is, in index tree less than than car plate until the storage location in heap table gets the data belonging to car plate 6 Until the value of the current sparse row to be checked of 6 biggers, the quick obtaining of the value to sparse row to be checked is realized.
Then above-described embodiment of the application, in Figure 5, the step S21 is according to record in upper layer node (root node) Sparse row value all minimum values in minimum value (car plate 1) start, according to sequence from small to large, successively by leaf section The value of the sparse row of guide record in point:Car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 are as current to be checked Sparse row value;When first time is by value of the car plate 1 as current sparse row to be checked, packet is searched in leaf node 1 First containing car plate 1 is guided record { to guide record 1:(car plate 1,1 line number 1 of data block) }, if { the data block in heap table 1 line number 1 } (i.e. first of the car plate 1 storage location guided in record corresponds to for the data that do not get belonging to the car plate 1 Data failed), then then obtain leaf node 1 in car plate 1 Article 2 guide record guide record 2:(car plate 1, 2 line number 1 of data block) }, it is got described in car plate 1 in heap table if can be corresponded to based on the storage location in guide record 2 Then the value (car plate 1) of the sparse row in the data is added in unique value set for data;If the Article 2 based on car plate 1 is guided Storage location in record cannot get the data belonging to corresponding car plate 1 in heap table, then continue to look into leaf node 1 Next of car plate 1 is looked for guide record (Article 3 guides record, Article 4 to guide record ...), in above-mentioned current leaf node 1 or follow-up leaf node (leaf node 2 ...), until get car plate 1 in heap table belonging to data, and will get Unique value set is added in the value of sparse row in the data, or until inquires the next value for guiding the sparse row in record (car plate 2 or car plate 3 or car plate 4 or car plate 5 or car plate 6) is different from the value (car plate 1) of current sparse row to be checked;Then it returns Root node is returned, the value by car plate 2 as current sparse row to be checked, until getting the value of the sparse row to be checked only One value set { car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 }.
Below with according in its leaf node for being included and the leaf node recorded in the root node in index tree It guides for the maximum value of the value of the sparse row of record, the step S21 and step S22 is illustrated.
In one embodiment of the application, as shown in fig. 6, what is recorded in upper layer node (root node) in index tree is on this The maximum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };The step S21 is according to the maximum value in all maximum values of the value of the sparse row recorded in upper layer node (root node) (car plate 6) starts, according to sequence from big to small, successively by the value of the sparse row of the guide record in leaf node:Car plate 6, The value of car plate 5, car plate 4, car plate 3, car plate 2 and car plate 1 as current sparse row to be checked, as the general in the step S22 When car plate 6 is as the currently value of sparse row to be checked, based on the 6 corresponding leaf node 4 of car plate recorded in root node, in leaf Lookup includes first guide record of car plate 6 in child node 4, obtains { guiding record 15:(car plate 6,2 line number of data block 3) storage location { 2 line number 3 of data block } }, being then based in guide record 15 obtains the number belonging to the car plate 6 in heap table According to if { 2 line number 3 of data block } in heap table gets the data belonging to the car plate 6, by the value of the sparse row in the data (car plate 6) is added in unique value set;It is then back to value of the root node by car plate 5 as current sparse row to be checked, is repeated Above-mentioned steps obtain that is, in index tree less than than car plate until the storage location in heap table gets the data belonging to car plate 1 Until the value of 1 smaller current sparse row to be checked, the quick obtaining of the value to sparse row to be checked is realized.
Then above-described embodiment of the application, in figure 6, the step S21 is according to record in upper layer node (root node) Sparse row value all maximum values in maximum value (car plate 6) start, according to sequence from big to small, successively by leaf section The value of the sparse row of guide record in point:Car plate 6, car plate 5, car plate 4, car plate 3, car plate 2 and car plate 1 are as current to be checked Sparse row value;When first time is by value of the car plate 6 as current sparse row to be checked, packet is searched in leaf node 4 First containing car plate 6 is guided record { to guide record 15:(car plate 6,2 line number 3 of data block) }, if { the data in heap table 2 line number 3 of block } do not get data (i.e. first of the car plate 6 storage location pair guided in record belonging to the car plate 6 The data answered have failed), then the Article 2 for then obtaining the car plate 6 in leaf node 4 guides record { to guide record 16:(car plate 6,4 line number 4 of data block) }, 6 institute of car plate is got in heap table if can be corresponded to based on the storage location in guide record 16 Then the value (car plate 6) of the sparse row in the data is added in unique value set for the data stated;If the Article 2 based on car plate 6 It guides the storage location in record that cannot get the data belonging to corresponding car plate 6 in heap table, then continues in leaf node 4 It is middle to search next of car plate 6 and guide record, in above-mentioned current leaf node 6 or follow-up leaf node (leaf node 5 ...), Until getting the data affiliated in heap table of car plate 6, and the value of the sparse row in the data got is added uniquely Value set, or until inquire next guide record in sparse row value (car plate 5 or car plate 4 or car plate 3 or car plate 2 or Car plate 1) it is different from the value (car plate 6) of current sparse row to be checked;It is then back to root node, by car plate 5 as current to be checked Ask sparse row value, until get the sparse row to be checked value unique value set car plate 1, car plate 2, car plate 3, Car plate 4, car plate 5 and car plate 6 }.
Further, the upper layer node includes the last layer branch node of the leaf node and the branch node Last layer root node,
Leaf node that the step S21 is included according to the upper layer node recorded in the upper layer node in index tree and The most value of the value of the sparse row of guide record in the leaf node, including:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to its leaf node for being included and the leaf recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in child node.
It selects below so that the most value is minimum value as an example, carrying out embodiment in detail to the step S21 explains.Exist In the embodiment of the application, as shown in figure 4, record has n × n × n datas in heap table, in metadata node (meta Page it includes root node (root page), one layer of branch node (branch page) and leaf node that the index tree is preset in) (leaf page), wherein default individual node can store n items guide record, then index tree herein can store n × n × N items guide record, are preset with n branch node, include n leaf node and each leaf node under each branch node The corresponding n items that can store up to guide record, obtain by sparse row (car plate of vehicle) since car plate 1, by all car plates Attendance record in heap table is according to the corresponding sequence of turning out for work of sequence and car plate of car plate, depositing each data of each car plate successively Storage space, which is set, to be respectively written into each leaf node.
Then above-described embodiment of the application begins look for sparse row in the figure 7 by taking sparse row (car plate of vehicle) as an example Unique value set, grey parts in scanning figure 7 first find sparse row (car plate of vehicle) by metadata node Root node in index tree, then, since the minimum value of sparse row (car plate of vehicle), i.e., car plate 1 starts, and scans root section Point by the car plate 1 and its corresponding branch node 1 recorded in root node, then scans branch node 1, according in branch node 1 Then the car plate 1 and its corresponding leaf node 1 of record scan leaf node 1, corresponding according to car plate 1 in leaf node 1 Record is guided, number corresponding with car plate 1 is searched in heap table according to the storage location in the guide record in leaf node 1 one by one According to such as the data of the grey parts in heap table, the storage location found in the guide record in leaf node 1 is corresponded in heap table In data, obtain it is sparse row (car plate of vehicle) minimum value car plate 1;Then, return root node in, according to car plate from it is small to Big sequence then searches the corresponding data in heap table of car plate 2, i.e., according to grey parts shown in Fig. 8, first scans root section Point, by the car plate 2 and its corresponding branch node 2 recorded in root node, in scanning branch node 2, according in branch node 2 The car plate 1 of record and its corresponding leaf node n+1 and car plate 2 and its corresponding leaf node n+2, since the application is currently real Apply in example be branch node record leaf node in sparse row minimum value, car plate 1 be leaf node n+1 in minimum Value, does not represent in leaf node n+1 that there is no the guide records for including car plate 2, therefore after scanning through branch node 2, That then first scan is leaf node n+1, is scanned in leaf node n+1 to the multiple guides record for including car plate 2, according to The sequence of turning out for work of car plate, one by one by include car plate 2 guide record in storage location is searched in heap table it is corresponding effectively Data, as shown in Figure 8 the data of the grey bar in heap table find the corresponding effective data of car plate 2, obtain sparse row (vehicle Car plate) value car plate 2, respectively obtained dilute based on above-mentioned lookup circulation step according to the sequence of license plate number from small to large Dredge the set of the value of row (car plate of vehicle), i.e., unique value set car plate 1, car plate 2 ..., car plate n, by index tree Car plate successively screen to determine the leaf node to be inquired, and then can rapidly get it is current to be checked sparse The value of row and while get affiliated data, reduces the scanning of the branch node and leaf node in index tree, and then subtract The workload searched less, improves the working efficiency of the unique value of the sparse row of quick obtaining, and realization quickly finds the sparse row Unique value.
Further, the upper layer node includes root node, in the multilayer point between the root node and leaf node Zhi Jiedian,
Leaf node that the step S21 is included according to the upper layer node recorded in the upper layer node in index tree and The most value of the value of the sparse row of guide record in the leaf node, including:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to recording next layer of branch node that the branch node is included and next layer of branch's section in branch node The most value of the value of sparse row in point;
Finally the sparse of record is guided according to being recorded in branch node in the leaf node and the leaf node that it is included The most value of the value of row.
For to select the number of plies by the most value for minimum value and the branch node below be 2 layers, to the step S21 Embodiment in detail is carried out to explain.I.e. in the embodiment of the application, record has n × n × n × n datas in heap table, It includes root node (root page), first layer branch node (first that the index tree is preset in metadata node (meta page) Branch page), second layer branch node (second branch page) and leaf node (leaf page), wherein it is pre- If individual node can store n items and guide record, then index tree herein can store n × n × n × n items and guide record, preset Every layer of branch node has n, includes n leaf node under each branch node, and each leaf node is corresponding can be with It stores up to n items and guides record, obtain sparse row (car plate of vehicle) since successively will be in each data of each car plate car plate 1 Including the guide record of storage location is respectively written into each leaf node.
Then above-described embodiment of the application begins look for sparse row only by taking sparse row (car plate of vehicle) as an example One value set, the first grey parts in scanning figure 7 find the index of sparse row (car plate of vehicle) by metadata node Root node in tree, then, since the minimum value of sparse row (car plate of vehicle), i.e., car plate 1 starts, and scans root node, leads to The car plate 1 recorded in root node and its corresponding first branch node 1 are crossed, then scans the first branch node 1, according to the first branch The car plate 1 and its corresponding second branch node 1 recorded in node 1, then scans the second branch node 1, obtains the second branch The car plate 1 and its corresponding leaf node 1 recorded in node 1 finally scans leaf node 1, according to car plate in leaf node 1 1 corresponding guide record, is searched and car plate 1 one by one according to the storage location in the guide record in leaf node 1 in heap table Corresponding data, if got in heap table in leaf node 1 include car plate 1 guide record in storage location correspond to Data, then obtain it is sparse row (car plate of vehicle) minimum value car plate 1;Then, return root node in, according to car plate from it is small to Big sequence, then based on above-mentioned finding step, search car plate 2, car plate 3 ..., car plate n it is corresponding in heap table Data to get to the set of the value of sparse row (car plate of vehicle), i.e., unique value set car plate 1, car plate 2 ..., car plate N }, the leaf node to be inquired is determined by the successively screening of the car plate in index tree, and then can rapidly get The value of current sparse row to be checked and while get affiliated data, reduces the branch node and leaf section in index tree The scanning of point, and then the workload searched is reduced, the working efficiency of the unique value of the sparse row of quick obtaining is improved, is realized quick Find the unique value of the sparse row.
Fig. 9 shows a kind of storage device of data containing sparse row according to the application one side, is applied to data The corresponding server end in library, the equipment include acquisition device 11, storage device 12 and recording device 13, wherein obtain number first According to all data recorded in the heap table in library, obtained in the acquisition device 11 each data storage location and it is corresponding should The value of sparse row in data, and the value of the sparse row in the storage location and the corresponding data for the data that each is recorded Record is guided as one, obtains the guide record of the value of the sparse row in the corresponding data of storage location of each data, The storage device 12 is used for the value sequence from small to large according to the sparse row by all guide records, is sequentially stored into rope Draw tree each continuous leaf node (leaf page) (for example, leaf node 1, leaf node 2, leaf node 3 ..., leaf Child node m);The most described recording device 13 is used to record the upper layer node in the corresponding upper layer node of each leaf node Leaf node and its leaf node in guide record sparse row value most value (for example, leaf node 1 upper layer save Recorded in point leaf node 1,2 that upper layer node included ..., in m and leaf node 1 all guide records sparse row The most value of value, guide record all in leaf node 2 sparse row value most value ... and own in leaf node m Guide record sparse row value most value), not only realize to sparse row establishment index tree, subsequently rapidly to obtain To the unique value for the value that need to count sparse row, also by the value of the sparse row in heap table and its storage location of the affiliated data As guiding in each continuous leaf node of record write-in index tree, so as to subsequently from the guide record in leaf node Storage location find the data belonging to the value of the sparse row.
The index tree of the application further includes metadata node, wherein is stored in the metadata node (meta page) It is specific location of the root node (root page) in index tree in index tree, quickly to find under the index tree Root node, meanwhile, before creating index tree, the number of plies of the also preset index that need to be created of the metadata node and corresponding each layer The number of nodes of node is preset and the corresponding quantity for recording result of node is preset, for example, the preset establishment in metadata node Index tree includes root node and leaf node, including 4 leaf nodes and each leaf node store up to 4 and guide record, And then management of the realization to index tree.
It should be noted that the data are in the heap table deposited in the database, wherein the data in heap table are that do not have There is storage order, it can be with to add memory space as unit of data block at end of file in heap table, in each data block At least one data are recorded, with the continuous renewal of the data in heap table, deletion etc., some data blocks can discharge memory space, The data that the needs being then newly inserted into record then randomly are stored in the heap table corresponding data block of free remaining memory space.
The leaf node in the embodiment of the present application is the bottom of the index tree, wherein in the leaf node not only The storage location ROWID (such as data block ID+ line numbers in heap table) for storing the data in heap table, is also stored the data In guide record in sparse row value, such as leaf node 1 includes sparse row 1, sparse row 2, then has in leaf node Guide be recorded as (guide record 1:The value1 of sparse row 1, storage location ROWID1), (guide record 2:Sparse row 2 Value1, storage location ROWID3) and (guide record 3:The value2 of sparse row 1, storage location ROWID2) }.
Further, the recording device 13 is used for:The upper layer node is recorded in the upper layer node of the leaf node Including leaf node and the leaf node in guide record sparse row value maximum value or minimum value.If for example, dilute It dredges and is classified as the car plate of vehicle, be respectively leaf node 1 and leaf node 2 there are two leaf node, wherein leaf node 1 includes Guide be recorded as guide record 1 (car plate 1, storage location ROWID1) and guide record 1 (car plate 2, storage location ROWID9) }, the guide that leaf node 2 includes is recorded as { guiding 1 (car plate 3, storage location ROWID14) of record and guiding record 1 (car plate 4, storage location ROWID23) }, then have and records leaf node 1 and its middle guide note in the upper layer node of leaf node The minimum value of the value of the car plate of record:The minimum value of the value of the car plate of car plate 1 and leaf node 2 and its middle guide record:Car plate 3; Or the maximum value of the value of the car plate of leaf node 2 and its middle guide record is recorded in the upper layer node of leaf node:2 He of car plate The maximum value of the value of the car plate of leaf node 2 and its middle guide record:Car plate 4, realizing will record in each leaf node Most value in the value of all sparse row guided in record is extracted in upper layer node, most so as to the value subsequently based on sparse row Value and corresponding leaf node find the data belonging to the value of the sparse row, and then can rapidly get sparse row Unique value.
Further, when the data recorded in heap table are less, the upper layer node that the index tree includes is the leaf The last layer root node of node, the i.e. top layer of the index tree are root node, which further includes undermost leaf node, When the data recorded in heap table are less, the index tree includes root node and leaf node;Then the recording device 13 For:The sparse row in the guide record in the leaf node and the leaf node that it is included are recorded in the root node The most value of value.
In one embodiment of the application, as shown in Fig. 2, record has 16 datas in heap table, by the storage position of each data It sets and the value of sparse row therein makees that record is guided to be stored respectively in leaf node 1, leaf node 2, leaf section in index tree In point 3 and leaf node 4, then there is having for the write-in of leaf node 1:{ guide record 1:(car plate 1,1 line number 1 of data block) guides note Record 2:(car plate 1,2 line number 1 of data block) guides record 3:(car plate 1,3 line number 1 of data block) and guide record 4:(car plate 2, number According to 1 line number 2 of block) }, what is be written in leaf node 2 has:{ guide record 5:(car plate 2,1 line number 3 of data block) guides record 6: (car plate 2,3 line number 2 of data block) guides record 7:(car plate 3,2 line number 4 of data block) and guide record 8:(car plate 3, data block 3 Line number 3) }, what is be written in leaf node 3 has:{ guide record 9:(car plate 3,4 line number 1 of data block) guides record 10:(car plate 4,1 line number 4 of data block), guide record 11:(car plate 4,3 line number 4 of data block) and guide record 12:(car plate 4,4 row of data block Number 3) what is } and in leaf node 4 be written has:{ guide record 13:(car plate 5,2 line number 3 of data block) guides record 14:(vehicle Board 5,4 line number 2 of data block), guide record 15:(car plate 6,2 line number 2 of data block) and guide record 16:(car plate 6, data block 4 Line number 4) }, then the recording device 13 recorded in the root node leaf node 1 that it is included to leaf node 4 and The minimum value of the value of the sparse row in guide record in each leaf node, then have in root node and be recorded as { (car plate 1:Leaf Node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf node 5) }, realizing will be in heap table The guide records of all data containing sparse row be written in each continuous leaf node, and realize each leaf node In guide record sparse row value in minimum value and its place leaf node deposit root node in, to be subsequently based on Record sparse row value in minimum value and its place leaf node rapidly obtain sparse row to be checked value and its The corresponding effective data recorded in heap table, and then reduce searching work amount and improve the working efficiency of lookup.
In another embodiment of the application, if as shown in figure 3, record has 16 datas in heap table, by each data Storage location and the value of sparse row therein make to guide record be stored respectively in the leaf node 1 in index tree, leaf node 2, In leaf node 3 and leaf node 4, then there is having for the write-in of leaf node 1:{ guide record 1:(car plate 1,1 line number 1 of data block), Guide record 2:(car plate 1,2 line number 1 of data block) guides record 3:(car plate 1,3 line number 1 of data block) and guide record 4:(vehicle Board 2,1 line number 2 of data block) }, what is be written in leaf node 2 has:{ guide record 5:(car plate 2,1 line number 3 of data block) guides note Record 6:(car plate 2,3 line number 2 of data block) guides record 7:(car plate 3,2 line number 4 of data block) and guide record 8:(car plate 3, number According to 3 line number 3 of block) }, what is be written in leaf node 3 has:{ guide record 9:(car plate 3,4 line number 1 of data block) guides record 10: (car plate 4,1 line number 4 of data block) guides record 11:(car plate 4,3 line number 4 of data block) and guide record 12:(car plate 4, data 4 line number 3 of block) } and leaf node 4 in be written have:{ guide record 13:(car plate 5,2 line number 3 of data block) guides record 14:(car plate 5,4 line number 2 of data block) guides record 15:(car plate 6,2 line number 2 of data block) and guide record 16:(car plate 6, number According to 4 line number 4 of block) }, then the recording device 13 records leaf node 1 that it is included to leaf section in the root node The maximum value of the value of the sparse row in guide record in point 4 and each leaf node, then have in root node and be recorded as { (car plate 2:Leaf node 1), (car plate 3:Leaf node 2), (car plate 4:Leaf node 3) and (car plate 6:Leaf node 4) }, realize by The guide record of all data containing sparse row in heap table is written in each continuous leaf node, and realizes each leaf In the leaf node deposit root node of maximum value and its place in the value of the sparse row of guide record in child node, with after an action of the bowels The leaf node of maximum value and its place in the value of the continuous sparse row based on record rapidly obtains sparse row to be checked Value and its corresponding effective data recorded in heap table, and then reduce searching work amount and improve the working efficiency of lookup.
Further, when the data recorded in heap table are more, the upper layer node that the index tree includes includes the leaf The last layer branch node of child node and the last layer root node of the branch node, the i.e. top layer of the index tree are root section Point, middle layer are one layer of branch node, which further includes undermost leaf node, i.e., the data recorded in heap table compared with When more, the index tree includes root node, one layer of branch node and leaf node;Then the recording device 13 is used for:
The leaf node and the leaf node that it is included are recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of middle guide record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
It selects below so that the most value is minimum value as an example, carrying out embodiment in detail to the recording device 13 explains. I.e. in the embodiment of the application, as shown in figure 4, record has n × n × n datas in heap table, in metadata node It includes root node (root page), one layer of branch node (branch page) and leaf that the index tree is preset in (meta page) Child node (leaf page), wherein default individual node can store n items and guide record, then index tree herein can store N × n × n items guide record, are preset with n branch node, include n leaf node and each leaf under each branch node The corresponding n items that can store up to of child node guide record, obtain by sparse row (car plate of vehicle) since car plate 1, by vehicle Attendance record of the board 1 in heap table is according to sequence of turning out for work, successively by the guide of the corresponding car plate 1 of the storage location of each data Record write-in branch leaf node 1, after leaf and node 1 write n datas, will successively record 1 corresponding guide of car plate It is written in leaf node 2, after writing the data that the correspondence of car plate 1 records in heap table, then by guide record corresponding with car plate 2 It is sequentially written in leaf node 2 and subsequent leaf node by turning out for work, in this way, by corresponding the going out in heap table of 1000 car plates The data frequently recorded are written in the form of guide in each continuous leaf node;Then the recording device 13 is in leaf node Last layer branch node in record the values of the sparse row that record is guided in the leaf node and the leaf node that it is included Minimum value, as record has the minimum value car plate 1 and corresponding leaf node 1, car plate 1 of sparse row in the branch node 1 in Fig. 4 And corresponding leaf node 2, car plate 1 and corresponding leaf node 3 ... and car plate 1 and corresponding leaf node n;Branch Record has minimum value car plate 1 and its corresponding leaf node n+1, the car plate 2 and its corresponding leaf node of sparse row in node 2 N+2, car plate 2 and its corresponding leaf node n+3 ..., car plate 2 and its corresponding leaf node m ... ..., successively will be each The minimum value and corresponding leaf node that the value of the sparse row (car plate of vehicle) of record is guided in leaf node are remembered as one Record the corresponding branch node that corresponding last layer is written;Then, its next layer of branch node for being included is recorded in root node And the minimum value of the value of the sparse row in the next layer of branch node, as record has each branch node in the root node in Fig. 4 Minimum value and its corresponding branch node:Car plate 1:Branch node 1, car plate 1:Branch node 2, car plate 3:Branch node 3 ... ..., car plate 1000:Branch node n realizes all data in the case of the more data that will be recorded in heap table Mapping is written into each continuous leaf node in index tree respectively in the form of guiding and record, and realizes each leaf The leaf node of minimum value and its place in the value of the sparse row of guide record in node is stored in corresponding branch node, And using in the value of the sparse row in each branch node minimum value and its corresponding branch node as one record write-in correspond to Root node in, so as to minimum value and its place in the value subsequently based on the sparse row recorded in root node branch node and The minimum value of the sparse row of corresponding next layer of branch node record and its corresponding leaf node, and then rapidly obtain to be checked The value and its corresponding effective data recorded in heap table for the sparse row ask, and then reduce searching work amount and improve lookup Working efficiency.
Further, when there are many data recorded in heap table, the upper layer node that the index tree includes includes root node, Multilayer branch node between the root node and leaf node, the index tree further include undermost leaf node, i.e., When there are many data recorded in heap table, the index tree includes root node, multilayer branch node and leaf node;Then institute Recording device 13 is stated to be used for:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node Most value, or record in branch node the sparse row in the next layer of branch node and the next layer of branch node that it is included Value most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node Most value.
For to select the number of plies by the most value for minimum value and the branch node below be 2 layers, the record is filled Setting 13 progress, embodiment is explained in detail.I.e. in the embodiment of the application, record has n × n × n × n item numbers in heap table According to it includes root node (root page), first layer branch node to preset the index tree in metadata node (meta page) (first branch page), second layer branch node (second branch page) and leaf node (leaf page), Wherein, default individual node can store n items and guide record, then index tree herein can store n × n × n × n items and guide note Record, default every layer of branch node have n, include n leaf node under each branch node, and each leaf node corresponds to Can store up to n items guide record, obtain by sparse row (car plate of vehicle) since car plate 1, by car plate 1 in heap table Attendance record according to turn out for work sequence, successively by the guide of the corresponding car plate 1 of the storage location of each data record write-in point 1 corresponding guide of car plate will be recorded write-in leaf section by branch leaf node 1 successively after leaf and node 1 write n datas In point 2, after writing the data that the correspondence of car plate 1 records in heap table, then by guide record corresponding with car plate 2 by sequence of turning out for work It is written in leaf node 2 and subsequent leaf node, in this way, by the number of 1000 corresponding attendance records in heap table of car plate According in each continuous leaf node of write-in in the form of guide;Then the last layer of the recording device 13 in leaf node The minimum value that the value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node, Record has minimum value car plate 1 and corresponding leaf node 1, the car plate 1 and corresponding leaf of sparse row in second layer branch node 1 Node 2, car plate 1 and corresponding leaf node 3 ... and car plate 1 and corresponding leaf node n;Second layer branch node 2 It is middle record have the minimum value car plate 1 and its corresponding leaf node n+1 of sparse row, car plate 2 and its corresponding leaf node n+2, Car plate 2 and its corresponding leaf node n+3 ..., car plate 2 and its corresponding leaf node m ... ..., successively by each leaf Guided in node the value of the sparse row (car plate of vehicle) of record minimum value and corresponding leaf node as one record pair The second layer branch node for the corresponding last layer of write-in answered;Then, each of corresponding lower layer is recorded in first layer branch node 1 The minimum value of second layer branch node and its corresponding sparse row (car plate);Then, root node record its included first The minimum value of the value of layer branch node and the sparse row in the first layer branch node, record has each first layer point in root node The minimum value of Zhi Jiedian and its corresponding first layer branch node:Car plate 1:First layer branch node 1, car plate 1:First layer branch Node 2, car plate 3:First layer branch node 3 ... ..., car plate 1000:First layer branch node n, realizing will record in heap table More data in the case of all data in the form of guiding record respectively mapping write-in to respectively connecting in index tree In continuous leaf node, and realize the minimum value in the value for the sparse row for recording the guide in each leaf node and its institute Leaf node be stored in corresponding second layer branch node, and will be in the value of the sparse row in each second layer branch node Minimum value and its corresponding second layer branch node are written as a record in corresponding first layer branch node, finally by the Minimum value and its corresponding first layer branch node in the value of sparse row in one layer of branch node is as a record write-in In corresponding root node, saved so as to the branch of minimum value and its place in the value subsequently based on the sparse row recorded in root node The minimum value of the sparse row of point and corresponding next layer of first layer branch node record and its corresponding second layer branch node and The minimum value of the sparse row of corresponding next layer of second layer branch node record and its corresponding leaf node, and then rapidly The value of sparse row to be checked and its corresponding effective data recorded in heap table are obtained, and then reduce searching work amount simultaneously Improve the working efficiency searched.
It is corresponding to be applied to database for the equipment that Figure 10 shows a kind of inquiry unique value according to the application other side Server end, the equipment includes determining to search device 21 and unique value statistic device 22, wherein this method is by having created Index tree, the determining device 21 of searching for being included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of guide record in leaf node and the leaf node, determines current sparse row to be checked Value;Then, the determining value for searching device 21 for searching current sparse row to be checked successively in the leaf node Affiliated first guides record, wherein in the storage location and the corresponding data of guiding record to include data The value of sparse row, it is described to guide value sequence from small to large of the record according to the sparse row, it is stored in respectively connecting for index tree successively Continuous leaf node;Finally, unique value statistic device 22 is used to guide the storage of data in record according to first found Unique value set is added in the value of sparse row in the data got by data described in position acquisition, is realized and is based on being somebody's turn to do Index tree is completed the quick obtaining of the unique value to the value of sparse row to be checked, is avoided to whole leaves in index tree Node is scanned, and also avoids scanning the scanning that the guide in all leaf nodes records the storage location of corresponding data, As long as corresponding first guide of the value for getting sparse row to be checked is recorded in corresponding data in heap table, then it can return to To upper layer node, next value of the value of sparse row to be checked is continued to search for, such lookup mode not only reduces scanning index The workload of tree also greatly improves the working efficiency of the unique value for the value for searching sparse row to be checked.
Further, the unique value statistic device 22 is additionally operable to:
If having not been obtained, current sparse row to be checked are searched successively in the leaf node of current queries or follow-up leaf node Value belonging to next guide record;
The storage location of the data in record is guided to obtain the data according to next found, it, will if getting Unique value set is added in the value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will obtain Unique value set is added in the value of sparse row in the data got, or until dilute in the next guide record inquired The value for dredging row is different from the value of current sparse row to be checked.
In one embodiment of the application, if in the determining value (vehicle for searching the current sparse row to be checked of lookup in device 21 Board 1) belonging to first guide record when, the unique value statistic device 22 is worked as according to what is found in leaf node First storage location guided in record belonging to the value (car plate 1) of preceding sparse row to be checked, correspondence is got in heap table The data, then unique value set { car plate 1 } is added in the value of the sparse row in the data got;If described unique First in primary system counter device 22 belonging to the value (car plate 1) of the current sparse row to be checked found in leaf node Guide record in storage location, corresponding data are not got in heap table, then the leaf node of current queries (for example, Next belonging to the value (car plate 1) of the current sparse row to be checked value (car plate 1) for guiding record and current sparse row to be checked Affiliated first guides record in the same leaf node) or follow-up leaf node (for example, current sparse row to be checked It is worth first belonging to the value (car plate 1) that next belonging to (car plate 1) is guided record and current sparse row to be checked and guides note Record is in the adjacent different leaf nodes) search successively belonging to the value of current sparse row to be checked next guide note Record.
Then above-described embodiment of the application, the belonging to the value (car plate 1) according to the current sparse row to be checked of inquiry One is guided record after obtaining corresponding data failure in heap table, to be guided in record then according to next found The storage location of data obtains the data in heap table, if getting, unique value collection is added in the value containing sparse row It closes { car plate 1 }, if if having not been obtained, repeating belonging to the above-mentioned value (car plate 1) for inquiring current sparse row to be checked successively Next the step of guiding record, until getting corresponding data in heap table (for example, current sparse row to be checked Being worth former belonging to (car plate 1) guides the storage location correspondence of the data in record that corresponding data are not present in heap table, I.e. data have failed, and the subsequent a certain item belonging to the value (car plate 1) of current sparse row to be checked guides the number in record According to storage location correspond to data in heap table and effectively exist in), then by the value of the sparse row in the data got Unique value set { car plate 1 } is added, by above-mentioned repetitive cycling step, reduces to upper layer node and its corresponding leaf section The scanning of point, and then the workload of the unique value for the value for searching sparse row to be checked is greatly reduced, also improve lookup Working efficiency.
Further, if recorded in upper layer node in index tree be leaf node that the upper layer node is included and should The minimum value of the value of the sparse row of guide record in leaf node,
The determining device 21 of searching is used for:
In all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Small value starts, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
In one embodiment of the application, as shown in figure 5, what is recorded in upper layer node (root node) in index tree is on this The minimum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };In the determining all minimum values for searching device 21 according to the value of the sparse row recorded in upper layer node (root node) Minimum value (car plate 1) start, the grey parts in scanning figure 5 obtain the value car plate 1 of sparse row, then according to from small to large Sequence, successively by leaf node guide record sparse row value:Car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 It as the value of current sparse row to be checked, realizes the index of the value of sparse row to be checked, so that is obtained is to be checked Unique value set of the value for the sparse row ask is more accurate.
Further, if recorded in upper layer node in index tree be leaf node that the upper layer node is included and should The maximum value of the value of the sparse row of guide record in leaf node,
The determining device 21 of searching is used for:
In all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node most Big value starts, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value for the sparse row ask.
In one embodiment of the application, as shown in fig. 6, what is recorded in upper layer node (root node) in index tree is on this The maximum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };In the determining all maximum values for searching device 21 according to the value of the sparse row recorded in upper layer node (root node) Maximum value (car plate 6) start, the grey parts in scanning figure 6 obtain the value car plate 6 of sparse row to be checked, then according to Sequence from big to small, successively by the value of the sparse row of the guide record in leaf node:Car plate 6, car plate 5, car plate 4, car plate 3 And value of the car plate 2 as current sparse row to be checked, it realizes the index of the value of sparse row to be checked, so that obtaining Sparse row to be checked value unique value set it is more accurate.
Further, the upper layer node includes the last layer root node of the leaf node,
The determining device 21 of searching is used for:
According to the guide note in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of the sparse row of record.
Below with according in its leaf node for being included and the leaf node recorded in the root node in index tree It guides for the minimum value of the value of the sparse row of record, determining the specific of device 21 and unique value statistic device 22 is searched to described Implementation procedure is illustrated.
In one embodiment of the application, as shown in figure 5, what is recorded in upper layer node (root node) in index tree is on this The minimum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };In the determining all minimum values for searching device 21 according to the value of the sparse row recorded in upper layer node (root node) Minimum value (car plate 1) start, according to sequence from small to large, successively by the sparse row of the guide record in leaf node Value:The value of car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 as current sparse row to be checked.When it is described only It is right based on the car plate 1 recorded in root node in one primary system counter device 22 by car plate 1 when value as current sparse row to be checked The leaf node 1 answered, lookup includes first guide record of car plate 1 in leaf node 1, obtains { guiding record 1:(vehicle Board 1,1 line number 1 of data block) }, the storage location { 1 line number 1 of data block } being then based in guide record 1 obtains in heap table Data belonging to the car plate 1, if { 1 line number 1 of data block } in heap table gets the data belonging to the car plate 1, by the number The value (car plate 1) of sparse row in is added in unique value set;Root node is then back to by car plate 2 as current to be checked The value of sparse row, repeats the above steps, until the storage location in heap table gets the data belonging to car plate 6, i.e. index tree Until middle acquisition is less than the value than the current sparse row to be checked of 6 bigger of car plate, the value to sparse row to be checked is realized Quick obtaining.
Then above-described embodiment of the application, in Figure 5, the determining device 21 of searching is according to upper layer node (root node) Minimum value (car plate 1) in all minimum values of the value of the sparse row of middle record starts, and according to sequence from small to large, successively will The value of the sparse row of guide record in leaf node:Car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 are as current The value of sparse row to be checked;When first time is by value of the car plate 1 as current sparse row to be checked, in leaf node 1 Lookup includes that first of car plate 1 guides record { to guide record 1:(car plate 1,1 line number 1 of data block) }, if in heap table { 1 line number 1 of data block } does not get the data belonging to the car plate 1, and (i.e. first of the car plate 1 guides the storage position in record Corresponding data are set to have failed), then the Article 2 for then obtaining the car plate 1 in leaf node 1 guides record { to guide record 2: (car plate 1,2 line number 1 of data block) }, if can be corresponded to based on the storage location in guide record 2 car plate is got in heap table Then the value (car plate 1) of the sparse row in the data is added in unique value set for data described in 1;If second based on car plate 1 Item guides the storage location in record that cannot get the data belonging to corresponding car plate 1 in heap table, then continues in leaf section Next that car plate 1 is searched in point 1 guides record (Article 3 guides record, Article 4 to guide record ...), above-mentioned current Leaf node 1 or follow-up leaf node (leaf node 2 ...), until the data affiliated in heap table of car plate 1 are got, and will Unique value set is added in the value of sparse row in the data got, or until inquires dilute in next guide record The value (car plate 2 or car plate 3 or car plate 4 or car plate 5 or car plate 6) for dredging row is different from the value (car plate of current sparse row to be checked 1);It is then back to root node, the value by car plate 2 as current sparse row to be checked, until it is to be checked sparse to get this Unique value set { car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 } of the value of row.
Below with according in its leaf node for being included and the leaf node recorded in the root node in index tree It guides for the maximum value of the value of the sparse row of record, determining the specific of device 21 and unique value statistic device 22 is searched to described Implementation procedure is illustrated.
In one embodiment of the application, as shown in fig. 6, what is recorded in upper layer node (root node) in index tree is on this The maximum value of the value of the sparse row of guide record in leaf node and its leaf node that node layer is included, i.e., in root node Be recorded as { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (car plate 5:Leaf section Point is 5) };In the determining all maximum values for searching device 21 according to the value of the sparse row recorded in upper layer node (root node) Maximum value (car plate 6) start, according to sequence from big to small, successively by the sparse row of the guide record in leaf node Value:The value of car plate 6, car plate 5, car plate 4, car plate 3, car plate 2 and car plate 1 as current sparse row to be checked, when it is described only It is right based on the car plate 6 recorded in root node in one primary system counter device 22 by car plate 6 when value as current sparse row to be checked The leaf node 4 answered, lookup includes first guide record of car plate 6 in leaf node 4, obtains { guiding record 15: (car plate 6,2 line number 3 of data block) }, the storage location { 2 line number 3 of data block } in guide record 15 is then based in heap table The data belonging to the car plate 6 are obtained, it, will if { 2 line number 3 of data block } in heap table gets the data belonging to the car plate 6 The value (car plate 6) of sparse row in the data is added in unique value set;Root node is then back to by car plate 5 as current to be checked The value for the sparse row ask, repeats the above steps, until the storage location in heap table gets the data belonging to car plate 1, i.e. rope Until drawing the value obtained in tree less than current sparse row to be checked more smaller than car plate 1, realize to sparse row to be checked Value quick obtaining.
Then above-described embodiment of the application, in figure 6, the determining device 21 of searching is according to upper layer node (root node) Maximum value (car plate 6) in all maximum values of the value of the sparse row of middle record starts, and according to sequence from big to small, successively will The value of the sparse row of guide record in leaf node:Car plate 6, car plate 5, car plate 4, car plate 3, car plate 2 and car plate 1 are as current The value of sparse row to be checked;When first time is by value of the car plate 6 as current sparse row to be checked, in leaf node 4 Lookup includes that first of car plate 6 guides record { to guide record 15:(car plate 6,2 line number 3 of data block) }, if in heap table { 2 line number 3 of data block } does not get the data belonging to the car plate 6, and (i.e. first of the car plate 6 guides the storage position in record Corresponding data are set to have failed), then the Article 2 for then obtaining the car plate 6 in leaf node 4 guides record { to guide record 16: (car plate 6,4 line number 4 of data block) }, if can be corresponded to based on the storage location in guide record 16 vehicle is got in heap table Then the value (car plate 6) of the sparse row in the data is added in unique value set for data described in board 6;If based on car plate 6 Two are guided the storage location in record that cannot get the data belonging to corresponding car plate 6 in heap table, then are continued in leaf Next that car plate 6 is searched in node 4 guides record, in above-mentioned current leaf node 6 or follow-up leaf node (leaf node 5 ...), until getting the data affiliated in heap table of car plate 6, and the value of the sparse row in the data got is added Enter unique value set, or until inquires next value (car plate 5 or the car plate 4 or car plate 3 or vehicle for guiding the sparse row in record Board 2 or car plate 1) it is different from the value (car plate 6) of current sparse row to be checked;It is then back to root node, by car plate 5 as current The value of sparse row to be checked, until getting unique value set { car plate 1, car plate 2, the vehicle of the value of the sparse row to be checked Board 3, car plate 4, car plate 5 and car plate 6 }.
Further, the upper layer node includes the last layer branch node of the leaf node and the branch node Last layer root node,
The determining device 21 of searching is used for:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to its leaf node for being included and the leaf recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in child node.
It selects below so that the most value is minimum value as an example, the determining device 21 of searching is carried out implementing to illustrate in detail It releases.I.e. in the embodiment of the application, as shown in figure 4, record has n × n × n datas in heap table, in metadata node It includes root node (root page), one layer of branch node (branch page) and leaf that the index tree is preset in (meta page) Child node (leaf page), wherein default individual node can store n items and guide record, then index tree herein can store N × n × n items guide record, are preset with n branch node, include n leaf node and each leaf under each branch node The corresponding n items that can store up to of child node guide record, obtain by sparse row (car plate of vehicle) since car plate 1, by institute There is sequence and car plate corresponding turn out for work sequence of attendance record of the car plate in heap table according to car plate, successively by each number of each car plate According to storage location be respectively written into each leaf node.
Then above-described embodiment of the application begins look for sparse row in the figure 7 by taking sparse row (car plate of vehicle) as an example Unique value set, grey parts in scanning figure 7 first find sparse row (car plate of vehicle) by metadata node Root node in index tree, then, since the minimum value of sparse row (car plate of vehicle), i.e., car plate 1 starts, and scans root section Point by the car plate 1 and its corresponding branch node 1 recorded in root node, then scans branch node 1, according in branch node 1 Then the car plate 1 and its corresponding leaf node 1 of record scan leaf node 1, corresponding according to car plate 1 in leaf node 1 Record is guided, number corresponding with car plate 1 is searched in heap table according to the storage location in the guide record in leaf node 1 one by one According to such as the data of the grey parts in heap table, the storage location found in the guide record in leaf node 1 is corresponded in heap table In data, obtain it is sparse row (car plate of vehicle) minimum value car plate 1;Then, return root node in, according to car plate from it is small to Big sequence then searches the corresponding data in heap table of car plate 2, i.e., according to grey parts shown in Fig. 8, first scans root section Point, by the car plate 2 and its corresponding branch node 2 recorded in root node, in scanning branch node 2, according in branch node 2 The car plate 1 of record and its corresponding leaf node n+1 and car plate 2 and its corresponding leaf node n+2, since the application is currently real Apply in example be branch node record leaf node in sparse row minimum value, car plate 1 be leaf node n+1 in minimum Value, does not represent in leaf node n+1 that there is no the guide records for including car plate 2, therefore after scanning through branch node 2, That then first scan is leaf node n+1, is scanned in leaf node n+1 to the multiple guides record for including car plate 2, according to The sequence of turning out for work of car plate, one by one by include car plate 2 guide record in storage location is searched in heap table it is corresponding effectively Data, as shown in Figure 8 the data of the grey bar in heap table find the corresponding effective data of car plate 2, obtain sparse row (vehicle Car plate) value car plate 2, respectively obtained dilute based on above-mentioned lookup circulation step according to the sequence of license plate number from small to large Dredge the set of the value of row (car plate of vehicle), i.e., unique value set car plate 1, car plate 2 ..., car plate n, by index tree Car plate successively screen to determine the leaf node to be inquired, and then can rapidly get it is current to be checked sparse The value of row and while get affiliated data, reduces the scanning of the branch node and leaf node in index tree, and then subtract The workload searched less, improves the working efficiency of the unique value of the sparse row of quick obtaining, and realization quickly finds the sparse row Unique value.
Further, the upper layer node includes root node, in the multilayer point between the root node and leaf node Zhi Jiedian,
The determining device 21 of searching is used for:
First according to sparse in its next layer of branch node for being included and the next layer of branch node of root node record The most value of the value of row;
Further according to recording next layer of branch node that the branch node is included and next layer of branch's section in branch node The most value of the value of sparse row in point;
Finally the sparse of record is guided according to being recorded in branch node in the leaf node and the leaf node that it is included The most value of the value of row.
For to select the number of plies by the most value for minimum value and the branch node below be 2 layers, the determination is looked into It looks for device 21 to carry out embodiment in detail to explain.I.e. in the embodiment of the application, record has n × n × n × n in heap table Data, it includes root node (root page), first layer branch to preset the index tree in metadata node (meta page) Node (first branch page), second layer branch node (second branch page) and leaf node (leaf Page), wherein default individual node can store n items and guide record, then index tree herein can store n × n × n × n items It guides record, default every layer of branch node to have n, includes n leaf node under each branch node, and each leaf section The corresponding n items that can store up to of point guide record, obtain sparse row (car plate of vehicle) since car plate 1 successively by each vehicle The guide record comprising storage location is respectively written into each leaf node in each data of board.
Then above-described embodiment of the application begins look for sparse row only by taking sparse row (car plate of vehicle) as an example One value set, the first grey parts in scanning figure 7 find the index of sparse row (car plate of vehicle) by metadata node Root node in tree, then, since the minimum value of sparse row (car plate of vehicle), i.e., car plate 1 starts, and scans root node, leads to The car plate 1 recorded in root node and its corresponding first branch node 1 are crossed, then scans the first branch node 1, according to the first branch The car plate 1 and its corresponding second branch node 1 recorded in node 1, then scans the second branch node 1, obtains the second branch The car plate 1 and its corresponding leaf node 1 recorded in node 1 finally scans leaf node 1, according to car plate in leaf node 1 1 corresponding guide record, is searched and car plate 1 one by one according to the storage location in the guide record in leaf node 1 in heap table Corresponding data, if got in heap table in leaf node 1 include car plate 1 guide record in storage location correspond to Data, then obtain it is sparse row (car plate of vehicle) minimum value car plate 1;Then, return root node in, according to car plate from it is small to Big sequence, then based on above-mentioned finding step, search car plate 2, car plate 3 ..., car plate n it is corresponding in heap table Data to get to the set of the value of sparse row (car plate of vehicle), i.e., unique value set car plate 1, car plate 2 ..., car plate N }, the leaf node to be inquired is determined by the successively screening of the car plate in index tree, and then can rapidly get The value of current sparse row to be checked and while get affiliated data, reduces the branch node and leaf section in index tree The scanning of point, and then the workload searched is reduced, the working efficiency of the unique value of the sparse row of quick obtaining is improved, is realized quick Find the unique value of the sparse row.
In conclusion the application is in a kind of storage method of data containing sparse row of offer, by first obtaining heap The value of the storage location of the data recorded in table and the sparse row in the corresponding data, by the storage location of the data and right The value of sparse row in the data answered is recorded as guide;According to the value sequence from big to small of the sparse row, by institute Guide record is stated to be sequentially stored into each continuous leaf node of index tree;And it is recorded in the upper layer node of the leaf node The most value that the value of the sparse row of record is guided in leaf node and the leaf node that the upper layer node is included, not only realizes Creating index tree to sparse row will also be in heap table subsequently rapidly to get the unique value for the value that need to count sparse row The storage location of the value of sparse row and its affiliated data is as each continuous leaf for guiding record write-in index tree In node, subsequently to find the data belonging to the value of the sparse row from the storage location in the guide record in leaf node.
Further, the application is also in a kind of method of inquiry unique value of offer, by the index tree created, Guide in the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record, determines the value of current sparse row to be checked, and is searched successively in the leaf node First belonging to the value of current sparse row to be checked is guided record, wherein the guide record includes the storage position of data Set the value with the sparse row in the corresponding data, it is described to guide value from small to large suitable of the record according to the sparse row Sequence is stored in each continuous leaf node of index tree successively;And the storage of data in record is guided according to first found Position obtains the corresponding data, and unique value set is added in the value of the sparse row in the data got, is realized Based on the index tree, the quick obtaining of the unique value to the value of sparse row to be checked is completed.
A kind of vehicle in system that is applied to hire a car provided by the present application go out during vehicle containing sparse row (car plate) In the practical application scene of the storage method of data, the root node in the index tree of the sparse row of establishment is stored in metadata section In point, to be quickly found the root node of index tree;If there was only 6 vehicles, system of entirely hiring a car a whole day in whole system of hiring a car Go out that car data is all random to be stored in heap table, share 16 and go out car data, each is gone out to the storage location of car data And the value of car plate therein is as guiding in each leaf node for being stored respectively in index tree of record, respectively leaf node 1, Leaf node 2, leaf node 3 and leaf node 4, wherein what leaf node 1 was written has:{ guide record 1:(car plate 1, data 1 line number 1 of block), guide record 2:(car plate 1,2 line number 1 of data block) guides record 3:It (car plate 1,3 line number 1 of data block) and guides Record 4:(car plate 2,1 line number 2 of data block) }, what is be written in leaf node 2 has:{ guide record 5:(car plate 2,1 line number of data block 3) record 6, is guided:(car plate 2,3 line number 2 of data block) guides record 7:(car plate 3,2 line number 4 of data block) and guide record 8: (car plate 3,3 line number 3 of data block) }, what is be written in leaf node 3 has:{ guide record 9:(car plate 3,4 line number 1 of data block) refers to Draw record 10:(car plate 4,1 line number 4 of data block) guides record 11:(car plate 4,3 line number 4 of data block) and guide record 12:(vehicle Board 4,4 line number 3 of data block) } and leaf node 4 in be written have:{ guide record 13:(car plate 5,2 line number 3 of data block), Guide record 14:(car plate 5,4 line number 2 of data block) guides record 15:(car plate 6,2 line number 2 of data block) and guide record 16: (car plate 6,4 line number 4 of data block) }, using in heap table all storage locations for going out car data and its corresponding car plate as It guides record to be respectively stored in after each leaf node, due to the vehicle for including in the system of hiring a car less (only 6) and goes out Car data is less, then the index tree created to sparse row (car plate) only includes root node and leaf node, then in the root node The value of sparse row in the middle guide record recorded in the leaf node 1 to leaf node 4 and each leaf node that it is included Minimum value is recorded as { (car plate 1 that is, in root node:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node And (car plate 5 3):Leaf node 5) }, it realizes and each company is written into the guide record of all data containing sparse row in heap table In continuous leaf node, and realize the minimum value in the value for the sparse row for recording the guide in each leaf node and its institute Leaf node deposit root node in, so as to the leaf of minimum value and its place in the value of the sparse row subsequently based on record Node rapidly obtains the value of sparse row to be checked and its corresponding effective data recorded in heap table, and then reduces and look into The amount of looking for a job and the working efficiency for improving lookup.
A kind of vehicle in system that is applied to hire a car provided by the present application goes out the sparse row (car plate) of inquiry during vehicle only In the practical application scene of one value method, due to by the system of hiring a car in heap table the storage location gone out in car data and its Corresponding car plate as guiding record to be respectively stored in each leaf node, and by the minimum value of the car plate in each leaf node and Its corresponding current leaf node is separately recorded in root node, therefore in the unique value for inquiring sparse row (car plate) to be checked When, the root node of index tree need to be rapidly found by metadata node, then from the minimum value vehicle in the minimum value of car plate Board 1 starts, and scans root node { (car plate 1:Leaf node 1), (car plate 2:Leaf node 2), (car plate 3:Leaf node 3) and (vehicle Board 5:Leaf node 5) }, car plate 1 and its corresponding leaf node 1 are obtained, is then scanned all comprising vehicle in leaf node 1 The guide of board 1 records, and according to the storage location guided in record for including car plate 1, it includes vehicle to be got in heap table Board 1 goes out car data, then continues to search for car plate 2, car plate 3, car plate 4, car plate 5 and car plate according to the sequence of car plate from small to large 6 go out car data in heap table respectively, and then obtain the set of the value of sparse row (car plate), i.e., sparse row (car plate) to be checked Unique value set { car plate 1, car plate 2, car plate 3, car plate 4, car plate 5 and car plate 6 }, realize the value to sparse row to be checked Rapidly and accurately acquisition.
According to further aspect of the application, a kind of equipment based on calculating is provided, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed Manage device:
The value for obtaining the storage location and the sparse row in the corresponding data of data, by the storage location of data and right The value of sparse row in the data answered is recorded as guide;
According to the value sequence from small to large of the sparse row, record is guided to be sequentially stored into each continuous of index tree by described Leaf node;
The leaf node and the leaf node that the upper layer node is included are recorded in the upper layer node of the leaf node The most value of the value of the sparse row of middle guide record.
According to further aspect of the application, a kind of equipment based on calculating is provided, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed Manage device:
The leaf node and the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree In guide record sparse row value most value, determine the value of current sparse row to be checked;
It searches first belonging to the value of current sparse row to be checked successively in the leaf node and guides record, In, it is described to guide the value for recording the storage location and the sparse row in the corresponding data that include data, the guide record According to the value sequence from small to large of the sparse row, it is stored in each continuous leaf node of index tree successively;
The storage location of data in record is guided to obtain the data according to first found, described in getting Unique value set is added in the value of sparse row in data.
Obviously, those skilled in the art can carry out the application essence of the various modification and variations without departing from the application God and range.In this way, if these modifications and variations of the application belong to the range of the application claim and its equivalent technologies Within, then the application is also intended to include these modifications and variations.
It should be noted that the application can be carried out in the assembly of software and/or software and hardware, for example, can adopt With application-specific integrated circuit (ASIC), general purpose computer or any other realized similar to hardware device.In one embodiment In, the software program of the application can be executed by processor to realize steps described above or function.Similarly, the application Software program (including relevant data structure) can be stored in computer readable recording medium storing program for performing, for example, RAM memory, Magnetic or optical driver or floppy disc and similar devices.In addition, hardware can be used to realize in some steps or function of the application, example Such as, coordinate to execute the circuit of each step or function as with processor.
In addition, the part of the application can be applied to computer program product, such as computer program instructions, when its quilt When computer executes, by the operation of the computer, it can call or provide according to the present processes and/or technical solution. And the program instruction of the present processes is called, it is possibly stored in fixed or moveable recording medium, and/or pass through Broadcast or the data flow in other signal loaded mediums and be transmitted, and/or be stored according to described program instruction operation In the working storage of computer equipment.Here, including a device according to one embodiment of the application, which includes using Memory in storage computer program instructions and processor for executing program instructions, wherein when the computer program refers to When order is executed by the processor, method and/or skill of the device operation based on aforementioned multiple embodiments according to the application are triggered Art scheme.
It is obvious to a person skilled in the art that the application is not limited to the details of above-mentioned exemplary embodiment, Er Qie In the case of without departing substantially from spirit herein or essential characteristic, the application can be realized in other specific forms.Therefore, no matter From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and scope of the present application is by appended power Profit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent requirements of the claims Variation is included in the application.Any reference signs in the claims should not be construed as limiting the involved claims.This Outside, it is clear that one word of " comprising " is not excluded for other units or step, and odd number is not excluded for plural number.That is stated in device claim is multiple Unit or device can also be realized by a unit or device by software or hardware.The first, the second equal words are used for table Show title, and does not represent any particular order.

Claims (26)

1. a kind of storage method of the data containing sparse row, wherein the method includes:
The value for obtaining the storage location and the sparse row in the corresponding data of data, by the storage location of data and corresponding The value of sparse row in the data is recorded as guide;
According to the value sequence from small to large of the sparse row, by each continuous leaf for guiding record to be sequentially stored into index tree Child node;
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the most value of the value of the sparse row of record.
2. according to the method described in claim 1, wherein, the upper layer node institute is recorded in the upper layer node of the leaf node Including leaf node and the leaf node in guide record sparse row value maximum value or minimum value.
3. according to the method described in claim 1, wherein, the upper layer node includes the last layer root section of the leaf node Point,
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the most value of the value of the sparse row of record, including:
The sparse row in the guide record in the leaf node and the leaf node that it is included are recorded in the root node The most value of value.
4. according to the method described in claim 1, wherein, the upper layer node includes the last layer branch section of the leaf node The last layer root node of point and the branch node,
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the most value of the value of the sparse row of record, including:
It records in the branch node of the last layer of the leaf node and refers in the leaf node and the leaf node that it is included Draw the most value of the value of the sparse row of record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node is most Value.
5. according to the method described in claim 1, wherein, the upper layer node includes root node, it is in the root node and leaf Multilayer branch node between child node,
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the most value of the value of the sparse row of record, including:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node most Value, or record in branch node the value of next layer of branch node that it is included and the sparse row in the next layer of branch node Most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node is most Value.
6. a kind of method of inquiry unique value, wherein the method includes:
In the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record is guided, determines the value of current sparse row to be checked;
It searches first belonging to the value of current sparse row to be checked successively in the leaf node and guides record, wherein It is described that guide record include the value of the storage location and the sparse row in the corresponding data of data, the guide record according to The sequence of the value of the sparse row from small to large is stored in each continuous leaf node of index tree successively;
The storage location of data in record is guided to obtain the data, the data that will be got according to first found In the values of sparse row unique value set is added.
7. according to the method described in claim 6, wherein, institute is obtained according to the storage location of data in the guide record found After stating data, further include:
If having not been obtained, the value of current sparse row to be checked is searched successively in the leaf node of current queries or follow-up leaf node Affiliated next guides record;
The storage location of the data in record is guided to obtain the data according to next found, it, will be described if getting Unique value set is added in value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will get The data in the values of sparse row unique value set is added, or until next inquired guides the sparse row in record Value be different from the values of current sparse row to be checked.
8. according to the method described in claim 6, wherein, if what is recorded in upper layer node in index tree is the upper layer node institute Including leaf node and the leaf node in guide record sparse row value minimum value,
Determine the value of current sparse row to be checked, including:
Minimum value in all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node Start, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value of sparse row.
9. according to the method described in claim 6, wherein, if what is recorded in upper layer node in index tree is the upper layer node institute Including leaf node and the leaf node in guide record sparse row value maximum value,
Determine the value of current sparse row to be checked, including:
Maximum value in all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node Start, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value of sparse row.
10. according to the method described in claim 6, wherein, the upper layer node includes the last layer root section of the leaf node Point,
In the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record is guided, including:
According to the guide record in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of sparse row.
11. according to the method described in claim 6, wherein, the upper layer node includes the last layer branch of the leaf node The last layer root node of node and the branch node,
In the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record is guided, including:
First according to the sparse row in its next layer of branch node for being included and the next layer of branch node of root node record The most value of value;
Further according to its leaf node for being included and the leaf section recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in point.
12. according to the method described in claim 6, wherein, the upper layer node includes root node, it is in the root node and leaf Multilayer branch node between child node,
In the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record is guided, including:
First according to the sparse row in its next layer of branch node for being included and the next layer of branch node of root node record The most value of value;
Further according to being recorded in branch node in the next layer of branch node and the next layer of branch node that the branch node is included Sparse row value most value;
Finally according to recording the sparse row for guiding record in the leaf node and the leaf node that it is included in branch node The most value of value.
13. a kind of storage device of the data containing sparse row, wherein the equipment includes:
The value of acquisition device, the storage location for obtaining data and the sparse row in the corresponding data, by depositing for data Storage space is set with the value of the sparse row in the corresponding data as guide record;
Guide record is sequentially stored into index by storage device for the sequence of the value according to the sparse row from small to large Each continuous leaf node of tree;
Recording device, for recording the leaf node and be somebody's turn to do that the upper layer node is included in the upper layer node of the leaf node The most value of the value of the sparse row of record is guided in leaf node.
14. equipment according to claim 13, wherein the recording device is used for:
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the maximum value or minimum value of the value of the sparse row of record.
15. equipment according to claim 13, wherein the upper layer node includes the last layer root section of the leaf node Point,
The recording device is used for:
The sparse row in the guide record in the leaf node and the leaf node that it is included are recorded in the root node The most value of value.
16. equipment according to claim 13, wherein the upper layer node includes the last layer branch of the leaf node The last layer root node of node and the branch node,
The recording device is used for:
It records in the branch node of the last layer of the leaf node and refers in the leaf node and the leaf node that it is included Draw the most value of the value of the sparse row of record;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node is most Value.
17. equipment according to claim 13, wherein the upper layer node includes root node, in the root node and Multilayer branch node between leaf node,
The recording device is used for:
The value for the sparse row that record is guided in the leaf node and the leaf node that it is included is recorded in branch node most Value, or record in branch node the value of next layer of branch node that it is included and the sparse row in the next layer of branch node Most value;
The value of sparse row in root node records the next layer of branch node that it is included and the next layer of branch node is most Value.
18. a kind of equipment of inquiry unique value, wherein the equipment includes:
It determines and searches device, the leaf node for being included according to the upper layer node recorded in the upper layer node in index tree And the most value of the value of the sparse row of the guide record in the leaf node,
The value for determining current sparse row to be checked searches the value of current sparse row to be checked successively in the leaf node Affiliated first guides record, wherein in the storage location and the corresponding data of guiding record to include data The value of sparse row, it is described to guide value sequence from small to large of the record according to the sparse row, it is stored in respectively connecting for index tree successively Continuous leaf node;
Unique value statistic device, for being guided the storage location of data in record to obtain the number according to first found According to by the unique value set of value addition of the sparse row in the data got.
19. equipment according to claim 18, wherein the unique value statistic device is additionally operable to:
If having not been obtained, the value of current sparse row to be checked is searched successively in the leaf node of current queries or follow-up leaf node Affiliated next guides record;
The storage location of the data in record is guided to obtain the data according to next found, it, will be described if getting Unique value set is added in value containing sparse row, if having not been obtained, repeats the above steps until the acquisition data, then will get The data in the values of sparse row unique value set is added, or until next inquired guides the sparse row in record Value be different from the values of current sparse row to be checked.
20. equipment according to claim 18, wherein if what is recorded in upper layer node in index tree is the upper layer node Including leaf node and the leaf node in guide record sparse row value minimum value,
The determining device of searching is used for:
Minimum value in all minimum values of the value of the sparse row of guide record in the leaf node for included by upper layer node Start, by sequence from small to large, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value of sparse row.
21. equipment according to claim 18, wherein if what is recorded in upper layer node in index tree is the upper layer node Including leaf node and the leaf node in guide record sparse row value maximum value,
The determining device of searching is used for:
Maximum value in all maximum values of the value of the sparse row of guide record in the leaf node for included by upper layer node Start, by sequence from big to small, successively using the value of the sparse row of the guide record in leaf node as current to be checked The value of sparse row.
22. equipment according to claim 18, wherein the upper layer node includes the last layer root section of the leaf node Point,
The determining device of searching is used for:
According to the guide record in its leaf node for being included and the leaf node recorded in the root node in index tree The most value of the value of sparse row.
23. equipment according to claim 18, wherein the upper layer node includes the last layer branch of the leaf node The last layer root node of node and the branch node,
The determining device of searching is used for:
First according to the sparse row in its next layer of branch node for being included and the next layer of branch node of root node record The most value of value;
Further according to its leaf node for being included and the leaf section recorded in the branch node of the last layer of the leaf node The most value of the value of the sparse row of record is guided in point.
24. equipment according to claim 18, wherein the upper layer node includes root node, in the root node and Multilayer branch node between leaf node,
The determining device of searching is used for:
First according to the sparse row in its next layer of branch node for being included and the next layer of branch node of root node record The most value of value;
Further according to being recorded in branch node in the next layer of branch node and the next layer of branch node that the branch node is included Sparse row value most value;
Finally according to recording the sparse row for guiding record in the leaf node and the leaf node that it is included in branch node The most value of value.
25. a kind of equipment based on calculating, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the processing when executed Device:
The value for obtaining the storage location and the sparse row in the corresponding data of data, by the storage location of data and corresponding The value of sparse row in the data is recorded as guide;
According to the value sequence from small to large of the sparse row, by each continuous leaf for guiding record to be sequentially stored into index tree Child node;
It records in the upper layer node of the leaf node and refers in the leaf node and the leaf node that the upper layer node is included Draw the most value of the value of the sparse row of record.
26. a kind of equipment based on calculating, including:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the processing when executed Device:
In the leaf node and the leaf node that are included according to the upper layer node recorded in the upper layer node in index tree The most value of the value of the sparse row of record is guided, determines the value of current sparse row to be checked;
It searches first belonging to the value of current sparse row to be checked successively in the leaf node and guides record, wherein It is described that guide record include the value of the storage location and the sparse row in the corresponding data of data, the guide record according to The sequence of the value of the sparse row from small to large is stored in each continuous leaf node of index tree successively;
The storage location of data in record is guided to obtain the data, the data that will be got according to first found In the values of sparse row unique value set is added.
CN201710093382.0A 2017-02-21 2017-02-21 Method and equipment for querying unique value Active CN108460048B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710093382.0A CN108460048B (en) 2017-02-21 2017-02-21 Method and equipment for querying unique value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710093382.0A CN108460048B (en) 2017-02-21 2017-02-21 Method and equipment for querying unique value

Publications (2)

Publication Number Publication Date
CN108460048A true CN108460048A (en) 2018-08-28
CN108460048B CN108460048B (en) 2022-05-10

Family

ID=63228861

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710093382.0A Active CN108460048B (en) 2017-02-21 2017-02-21 Method and equipment for querying unique value

Country Status (1)

Country Link
CN (1) CN108460048B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101533406A (en) * 2009-04-10 2009-09-16 北京锐安科技有限公司 Mass data querying method
CN102024046A (en) * 2010-12-14 2011-04-20 成都市华为赛门铁克科技有限公司 Data repeatability checking method and device as well as system
CN102915382A (en) * 2012-11-21 2013-02-06 亚信联创科技(中国)有限公司 Method and device for carrying out data query on database based on indexes
CN103049521A (en) * 2012-12-19 2013-04-17 广东电子工业研究院有限公司 Mechanism and method for indexing virtual table supporting multi-attribute compound condition query
CN103761270A (en) * 2014-01-06 2014-04-30 大连理工大学 Method for orderly constructing and retrieving string data dictionary
US20150106382A1 (en) * 2013-10-11 2015-04-16 Oracle International Corporation Tables With Unlimited Number Of Sparse Columns And Techniques For An Efficient Implementation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101533406A (en) * 2009-04-10 2009-09-16 北京锐安科技有限公司 Mass data querying method
CN102024046A (en) * 2010-12-14 2011-04-20 成都市华为赛门铁克科技有限公司 Data repeatability checking method and device as well as system
CN102915382A (en) * 2012-11-21 2013-02-06 亚信联创科技(中国)有限公司 Method and device for carrying out data query on database based on indexes
CN103049521A (en) * 2012-12-19 2013-04-17 广东电子工业研究院有限公司 Mechanism and method for indexing virtual table supporting multi-attribute compound condition query
US20150106382A1 (en) * 2013-10-11 2015-04-16 Oracle International Corporation Tables With Unlimited Number Of Sparse Columns And Techniques For An Efficient Implementation
CN103761270A (en) * 2014-01-06 2014-04-30 大连理工大学 Method for orderly constructing and retrieving string data dictionary

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SRINI ACHARYA 等: ""Relational Support for Flexible Schema Scenarios"", 《PROCEEDINGS OF THE VLDB ENDOWMENT》 *
杨思箫: ""DWMS中列存储索引技术的研究与改进"", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 *
蔡文博: ""三峡库区三维地理信息***的设计与实现"", 《中国优秀博硕士学位论文全文数据库(硕士)基础科学辑》 *

Also Published As

Publication number Publication date
CN108460048B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
US20090248764A1 (en) Implementing Dynamic Processor Allocation Based Upon Data Density
WO2016149552A1 (en) Compaction policy
CN104268295B (en) A kind of data query method and device
JP2010503117A (en) Dynamic fragment mapping
CN113961514B (en) Data query method and device
CN103902702A (en) Data storage system and data storage method
CN104112008A (en) Multi-table data association inquiry optimizing method and device
CN105224532A (en) Data processing method and device
CN106156070A (en) A kind of querying method, Piece file mergence method and relevant apparatus
US20220414155A1 (en) Database management method and apparatus based on lookup table
CN105447030A (en) Index processing method and equipment
CN107704511A (en) A kind of SQL optimization methods and equipment
CN105468644A (en) Method and device for performing query in database
CN113253932B (en) Read-write control method and system for distributed storage system
CN109325022A (en) A kind of data processing method and device
CN110825953A (en) Data query method, device and equipment
CN108460048A (en) A kind of method and apparatus of inquiry unique value
CN113625967B (en) Data storage method, data query method and server
CN114428776A (en) Index partition management method and system for time sequence data
CN108920708B (en) Data processing method and device
CN113326262A (en) Data processing method, device, equipment and medium based on key value database
RU2656721C1 (en) Method of the partially matching large objects storage organization
CN113868267A (en) Method for injecting time sequence data, method for inquiring time sequence data and database system
EP3910489A1 (en) A data management system using attributed data slices
US11507293B2 (en) Method, electronic device and computer program product for managing storage blocks

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