CN110222074A - It indexes lookup method, search device, electronic equipment and storage medium - Google Patents

It indexes lookup method, search device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110222074A
CN110222074A CN201910515781.0A CN201910515781A CN110222074A CN 110222074 A CN110222074 A CN 110222074A CN 201910515781 A CN201910515781 A CN 201910515781A CN 110222074 A CN110222074 A CN 110222074A
Authority
CN
China
Prior art keywords
index
target
section
storage medium
mark
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.)
Pending
Application number
CN201910515781.0A
Other languages
Chinese (zh)
Inventor
尹滔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201910515781.0A priority Critical patent/CN110222074A/en
Publication of CN110222074A publication Critical patent/CN110222074A/en
Pending legal-status Critical Current

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • 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/2453Query optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a kind of index lookup method, device, electronic equipment and storage medium are searched, wherein method includes: to obtain target index mark;Target is indexed into mark based on default lookup algorithm and the multiple reference keys being stored in advance in the first storage medium mark is compared, determining target corresponding with target index mark indexes section;Index information corresponding with target index section is determined from the index file being stored in the second storage medium, obtains target index information, and target index information is read in the first storage medium;Target index mark is searched in target index information based on preset lookup algorithm, obtains index to be found.The embodiment of the present invention can shorten the lookup time of index.

Description

It indexes lookup method, search device, electronic equipment and storage medium
Technical field
The present invention relates to technical field of data storage, set more particularly to a kind of index lookup method, lookup device, electronics Standby and storage medium.
Background technique
Index is a kind of structure being ranked up to the value of one or more columns per page in database table, usually used in the prior art Index technology improves the access speed to database.
Specifically, since the readwrite performance of memory is significantly larger than the readwrite performance of disk, in the prior art usually by rope Quotation part is stored in memory, and when receiving database access request, reads index file first with location data in database Storage location, and then according to storage location access database, to substantially increase the access speed to database.
Inventor has found in the practice of the invention, when index file is too big, can not for a long time deposit index file Storage in memory, can only be stored on disk, this is because can consume storage system if index file is stored in memory It unites excessive memory source, storage system is caused to be dragged slowly.Therefore, it when reading data every time, requires entire rope Quotation part is read into memory from disk, then the reading result queries database based on index file again, to from database In get access result after discharge the occupied memory of index file.In this way, requiring elder generation when due to reading data every time Entire index file is read into memory, and index file itself is larger, when reading the process of memory and needing to expend longer Between, lead to the problem of influencing the access speed to database.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of index lookup method, searches device, electronic equipment and storage and be situated between Matter, to shorten the lookup time of index.Specific technical solution is as follows:
In a first aspect, the embodiment of the invention provides a kind of index lookup methods, comprising:
Target index mark is obtained, the target index is identified as the index mark of index to be found;
Multiple ginsengs that the target is indexed mark and is stored in advance in the first storage medium based on default lookup algorithm It examines index mark to be compared, determining target corresponding with target index mark indexes section;
Determine that index corresponding with target index section is believed from the index file being stored in the second storage medium Breath, obtains target index information, and the target index information is read in the first storage medium, first storage medium Reading and writing data performance be higher than second storage medium reading and writing data performance;
Target index mark is searched in the target index information based on preset lookup algorithm, obtain it is described to Search index.
Optionally, the reference key mark obtains by the following method:
The index file being stored in second storage medium is traversed in advance;
It extracts multiple indexes according to predetermined order interval from the index file to identify, as the reference key mark Know.
Optionally, the determining and target from the index file being stored in the second storage medium indexes section pair The step of index information answered, comprising:
Determine the serial number in target index section;
Starting of the target index section in the index file is determined based on the serial number in target index section Offset;
Determine the byte total amount for the index for including in target index section;
The mesh is determined based on the byte total amount for the index for including in the start offset amount and target index section Mark index information.
Optionally, the serial number in target index section is determined by the following method: section pair is indexed according to the target The reference key answered identifies the sequence in the multiple reference key, determines the serial number in target index section.
Optionally, determine that starting of the target index section in the index file is inclined based on the first default expression formula Shifting amount O, the first default expression formula are as follows:
O=N*Q*S
Wherein, N is the serial number that the target indexes section, and Q is the quantity that the target indexes the index for including in section, S is the byte quantity of every index.
Optionally, the byte total amount for the index for including in target index section is determined based on the second default expression formula TS, the second default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that the target indexes the index for including in section, and S is the byte quantity of every index.
Optionally, the preset lookup algorithm can be any one of following methods: dichotomy, binary sort tree Method, Hash table method, block research method.
Optionally, second storage medium is disk, and first storage medium is memory.
Second aspect, the embodiment of the invention provides a kind of indexes to search device, comprising:
Module is obtained, for obtaining target index mark, the target index is identified as the index mark of index to be found;
Determining module is situated between for being indexed mark by the target based on default lookup algorithm and being stored in advance in the first storage Multiple reference keys mark in matter is compared, and determining target corresponding with target index mark indexes section;
Read module indexes section with the target for determining from the index file being stored in the second storage medium Corresponding index information obtains target index information, and the target index information is read in the first storage medium, described The reading and writing data performance of first storage medium is higher than the reading and writing data performance of second storage medium;
Searching module, for searching the target index mark in the target index information based on preset lookup algorithm Know, obtains the index to be found.
Optionally, described device further include:
Spider module, for traversing the index file being stored in second storage medium in advance;
Abstraction module is identified for extracting multiple indexes according to predetermined order interval from the index file, as institute State reference key mark.
Optionally, the determining module, comprising:
First determines submodule, for determining the serial number in target index section;
Second determines submodule, for determining target index section in institute based on the serial number in target index section State the start offset amount in index file;
Third determines submodule, for determining the byte total amount for the index for including in target index section;
4th determines submodule, for based on the index for including in the start offset amount and target index section Byte total amount determines the target index information.
Optionally, it described first determines submodule, is specifically used for:
The corresponding reference key in section is indexed according to the target and identifies the sequence in the multiple reference key, is determined The serial number in target index section.
Optionally, determine that starting of the target index section in the index file is inclined based on the first default expression formula Shifting amount O, the first default expression formula are as follows:
O=N*Q*S
Wherein, N is the serial number that the target indexes section, and Q is the quantity that the target indexes the index for including in section, S is the byte quantity of every index.
Optionally, the byte total amount for the index for including in target index section is determined based on the second default expression formula TS, the second default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that the target indexes the index for including in section, and S is the byte quantity of every index.
Optionally, the preset lookup algorithm can be any one of following methods: dichotomy, binary sort tree Method, Hash table method, block research method.
Optionally, second storage medium is disk, and first storage medium is memory.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, including processor and machine readable storage medium, The machine readable storage medium is stored with the machine-executable instruction that can be executed by the processor, and the processor executes The machine-executable instruction is to realize the method and step of index lookup method that above-mentioned first aspect provides.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage Dielectric memory contains computer program, when the computer program is executed by processor, realizes the rope that above-mentioned first aspect provides Draw the method and step of lookup method.
5th aspect, the embodiment of the invention also provides a kind of computer program products comprising instruction, when it is being calculated When being run on machine, so that computer executes the method and step for the index lookup method that above-mentioned first aspect provides.
6th aspect, the embodiment of the invention also provides a kind of computer programs, when run on a computer, so that Computer executes the method and step for the index lookup method that above-mentioned first aspect provides.
A kind of index lookup method, lookup device, electronic equipment and storage medium provided in an embodiment of the present invention, are obtaining After target index mark, by the way that target is indexed mark and the multiple reference keys being stored in advance in the first storage medium mark It is compared, determining target index corresponding with target index mark section, and then from the rope being stored in the second storage medium Index information corresponding with target index section is determined in quotation part, and target index information is read into the first storage medium In, compared with the prior art reads entire index file, the embodiment of the present invention reads the index of the target in the first storage medium The index quantity of information greatly reduces, and then indexes read access time and shorten, so as to shorten the lookup time of index.Certainly, implement Any product of the invention or method must be not necessarily required to reach all the above advantage simultaneously.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is the first flow diagram of index lookup method provided in an embodiment of the present invention;
Fig. 2 is the storage schematic diagram of a plurality of index in the embodiment of the present invention;
Fig. 3 is a kind of flow diagram of step S103 in index lookup method provided in an embodiment of the present invention;
Fig. 4 is second of flow diagram of index lookup method provided in an embodiment of the present invention;
Fig. 5 is the first structural schematic diagram that index provided in an embodiment of the present invention searches device;
Fig. 6 is second of structural schematic diagram that index provided in an embodiment of the present invention searches device;
Fig. 7 is that index provided in an embodiment of the present invention is searched in device, a kind of structural schematic diagram of determining module;
Fig. 8 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Existing index lookup method can also usually use following scheme:
Under current application scenarios, since the index quantity generated in data storage procedure is excessive, cause index cannot It when being all put into memory, therefore reading data every time, requires first to read index from disk, reads data further according to index, But this method is needed from the index file stored in disk, index therein is traversed in order, until finding needs The index of reading, since worst situation is the index needed to be traversed in entire index file, since it is desired that when spending a large amount of Between, therefore application scenarios demanding for search performance and be not suitable for.
Have in view of that, as shown in Figure 1, the embodiment of the invention provides a kind of index lookup method, this method may include Following steps:
S101 obtains target index mark.
It is appreciated that the index mark of index can be generated after index is stored, index mark is used for identification index Storage order.After receiving to the inquiry request of certain data in database, number to be found is obtained from inquiry request It is identified according to the index of corresponding index, that is, target index mark.
S102, multiple ginsengs that target is indexed mark and is stored in advance in the first storage medium based on default lookup algorithm It examines index mark to be compared, determining target corresponding with target index mark indexes section.
In the embodiment of the present invention, multiple reference key marks, these references can be stored in the first storage medium in advance Index mark can be used for carrying out section mark to a plurality of index being stored in index file, to identify multiple index areas Between.Multiple reference key marks obtain by the following method: traversal index file, according to predetermined order interval from index file It extracts multiple index marks to identify as reference key, multiple reference key marks can be deposited in the form of array Storage.
The storing process of index is illustrated first below:
After one data is stored to disk, the corresponding index of the data can be generated, rapidly to lead in the future It crosses index generated and searches the data, then, for a plurality of index, can be saved according to preset storage order to index text In part, for example, storing each index according to the sequencing that index generates the time.
Illustratively, a plurality of index in the embodiment of the present invention can be stored according to form as shown in Figure 2, Fig. 2 In, after index is stored in index file, the index mark (being indicated with seq) of the index can be generated respectively, and index is compiled Number (being indicated with id), indexes the offset (being indicated with off) of corresponding data, indexes the size (being indicated with size) of corresponding data.
Wherein, above-mentioned index mark is corresponding with the storage order of each index, that is, above-mentioned index mark can identify each rope The storage order drawn;Above-mentioned index number is used to indicate the unique identification number of an index, normally, the index of an index Number and the current cable tendering of the index are sensible same;Above-mentioned offset is for indicating offset of the corresponding data of the index in disk Amount, so as to the corresponding data of positioning index on disk;Above-mentioned size is for indicating to index corresponding data in disk The size of occupied memory space.
With reference to Fig. 2 it is found that the index mark respectively indexed is continuous not always necessarily, for example, respectively indexing in Fig. 2 corresponding Index the sequence of mark are as follows: 0,2,3,4,6 ..., wherein 0 and 2 is discontinuous, and 2 to 4 is continuous, and 4 and 6 discontinuously, this be by In after institute's storing data is deleted, corresponding index will also be deleted therewith, it is thus possible to occur indexing discontinuous situation, But it can be appreciated that the whole sequencing of a plurality of index does not change, that is, above-mentioned index mark still according to Ascending sequence arrangement.
Below to reference key mark and mapping relations and the reference key mark of index file still by taking Fig. 2 as an example Generating process is further described:
Index file shown in Fig. 2 is traversed, index mark 0,28,36 is extracted in the way of being spaced 16 index datas, And put it into array seq_array predetermined, as reference key identify, thus establish reference key mark with The mapping relations of index file.Specifically, reference key mark 0,28,36, is divided into 3 index sections for index file: [0, 28), [28,61), [61, ∞), wherein [0,28) indicate that index is identified as the section of 0 to 28 (not including 28), [28,61) table Show that index is identified as the section of 28 to 61 (not including 61), [61, ∞) indicate that index is identified as 61 (not including 61) of later area Between.Wherein [61, ∞) it is also identified comprising the corresponding index of 16 indexes in section.
Target can be indexed mark by the embodiment of the present invention and multiple reference keys mark is compared, with determining and target The corresponding index section with index file of index mark, i.e. target index section.
Illustratively, if target index is identified as 39,39 and above-mentioned 0,28,61 can be compared, to determine target The corresponding target of index mark 39 indexes section.For example, compared using dichotomy, comparison procedure can be with are as follows: first by 39 with 28 compare, and 39 to 28 is big, then compares 39 with 61, and 39 to 61 is small, shows 39 in 28 and 61 this section, be expressed as [28, 61), which is target index section.
As a kind of optional embodiment of the embodiment of the present invention, can be searched using other lookup algorithms, example Such as, binary sort tree method, Hash table method, block research method etc..
As a kind of optional embodiment of the embodiment of the present invention, above-mentioned first storage medium is specifically as follows memory, interior Depositing has the characteristics that readwrite performance is high, delay is short, and above-mentioned reference key mark exactly needs the read-write feature of memory, that is, needs Rapidly reference key mark is read out, therefore, reference key mark is saved to memory, the property of memory can be utilized Energy advantage quickly determines that target corresponding with target index mark indexes section, to improve search efficiency.
The a plurality of index stored in order can be based on as a kind of optional embodiment of the embodiment of the present invention Reference key mark, carries out interval division to the index saved in index file in advance, that is, these indexes is divided to different It indexes in section, to quickly determine that target corresponding with target index mark indexes directly in the index section divided in advance Section.
With reference to Fig. 1, S103, determined from the index file being stored in the second storage medium corresponding with target index section Index information, obtain target index information, and target index information is read in the first storage medium.
After determining target index section, it can determine and be somebody's turn to do from the index file being stored in the second storage medium Target indexes the corresponding index information in region to get target index information is arrived.Illustratively, with reference to Fig. 2, when target indexes section For [28,61) when, then can in indexed file it is determining with target index section [28,61) corresponding index information then will Identified index information is read in the first storage medium, wherein the reading and writing data performance of the first storage medium is higher than second The reading and writing data performance of storage medium.Second storage medium, such as can be with are as follows: disk.
As a kind of optional embodiment of the embodiment of the present invention, as shown in figure 3, above-mentioned steps S103 is specifically as follows:
S1031 determines the serial number in target index section.
S1032 determines the start offset amount in target index section indexed file based on the serial number in target index section.
S1033 determines the byte total amount for the index for including in target index section.
S1034 determines that target indexes based on the byte total amount for the index for including in start offset amount and target index section Information.
Optionally, the start offset amount in target index section indexed file can be determined based on the first default expression formula O, the first default expression formula are as follows:
O=N*Q*S
Wherein, N is the serial number that target indexes section, and Q is the quantity that target indexes the index for including in section, and S is every The byte quantity of index.Those skilled in the art can flexibly set target and index section Zhong Bao according to actual business demand The quantity of the index contained, the specific value embodiment of the present invention is without limitation.
Step S1031~S1034 is illustrated below:
With reference to Fig. 2, identifying 3 index sections that 0,28,36 determine by 3 reference keys can be with are as follows: and [0,28), [28, 61), [61, ∞), be when target indexes section [28,61) when, then target index section is second section, and serial number N is 1 (being started counting from 0), then the start offset amount in indexed file are as follows: N*16*24, wherein 16 be to index indexed in section Number, 24 be the byte quantity indexed in indexed file (usually preset fixed size, unit are bit).According to above-mentioned One default expression formula: N*16*24=1*16*24=384 can determine the start offset in target index section indexed file Amount is 384.
Optionally, the byte total amount for the index for including in target index section can be determined based on the second default expression formula TS, the second default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that target indexes the index for including in section, and S is the byte quantity of every index.
Illustratively, the quantity for the index for including in target index section is 16, and the byte quantity of every index is 24, then It can determine the byte total amount TS for the index for including in target index section are as follows: 16*24=384.
As a kind of optional embodiment of the embodiment of the present invention, the corresponding reference key in section can be indexed according to target The sequence in multiple reference keys is identified, determines the serial number in target index section.
Illustratively, the corresponding reference key in target index section be identified as and 39,39 belong to [28,61) this target index Section, wherein 28 be the 2nd number in array [0,28,61], since array is calculated since 0, it is therefore desirable to subtract 2 1 is gone, obtains 1, that is, obtains 39 and belongs to the 1st section, that is, the serial number 1 in the target index section where 39.
With reference to Fig. 1, S104, target index mark is searched in target index information based on preset lookup algorithm, is obtained Index to be found.
After determining target index information, due to being identified in target index information comprising index to be found and its index, It can use preset lookup algorithm, target index mark searched in target index information, to obtain index to be found.
As a kind of optional embodiment of the embodiment of the present invention, in order to improve search speed, the embodiment of the present invention can be with It is searched using different default lookup algorithms, for example, dichotomy, binary sort tree method, Hash table method, block research method Deng.
It, illustratively, can be by target rope if the target index found is identified as 39 when using binary search Tendering know 39 with target index section [28,61) in be located in the middle index mark and 46 be compared, 39 less than 46, show the rope Draw in [28,46] this subinterval, then, recycle binary chop algorithm, by target index mark 39 with subinterval [28, 46] index mark is located in the middle in be compared, be located in the middle index mark is also 39 just, then index is found, into And the record of the index: seq:39 can be read, id:39, off:10210, size:40687.
As a kind of optional embodiment of the embodiment of the present invention, as shown in figure 4, reference key mark can be by following Method obtains:
S201 traverses the index file being stored in the second storage medium in advance.
The step can be located at before step S101.The embodiment of the present invention can be stored in the second storage by traversing in advance Index file in medium, for example, the index of each index can be generated with reference to Fig. 2 in the index file that traversal is stored in disk Mark.Index mark illustrates that details are not described herein again in the aforementioned embodiment.
S202 extracts multiple indexes according to predetermined order interval from index file and identifies, identifies as reference key.
It is appreciated that identifying for the multiple reference keys extracted, they are specifically as follows storage order number or rope Draw number, therefore reference key mark can be first passed through, determines the range of index mark corresponding to each index section, in turn Determine index mark range belonging to index mark to be found, also, due to index mark with index be it is one-to-one, After determining index mark range belonging to index mark, it can readily determine that target index identifies corresponding target index area Between.It can be used in determining that target index identifies corresponding target index section just because of above-mentioned reference identification, because referred to herein as joining Examine mark.By generating reference key mark, the time that determining target index identifies corresponding target index section can be shortened.
After obtaining multiple reference identifications, multiple reference identifications can be stored in the first storage medium, for example, being stored in In memory, for subsequent use.
A kind of index lookup method provided in an embodiment of the present invention, after obtaining target index mark, by by target rope Multiple reference keys mark that tendering is known and is stored in advance in the first storage medium is compared, determining to identify with target index Corresponding target indexes section, and then determining and target indexes section pair from the index file being stored in the second storage medium The index information answered, and target index information is read in the first storage medium, entire index file is read with the prior art It compares, the index quantity that the embodiment of the present invention reads the target index information in the first storage medium greatly reduces, and then rope Draw read access time shortening, so as to shorten the lookup time of index.
Corresponding to above method embodiment, embodiment that the embodiment of the present invention also provides corresponding devices.
As shown in figure 5, the embodiment of the invention provides a kind of indexes to search device, the dress corresponding with embodiment illustrated in fig. 1 It sets and includes:
Module 501 is obtained, for obtaining target index mark, target index is identified as the index mark of index to be found.
Determining module 502 is situated between for being indexed mark by target based on default lookup algorithm and being stored in advance in the first storage Multiple reference keys mark in matter is compared, and determining target corresponding with target index mark indexes section.
Read module 503 indexes section with target for determining from the index file being stored in the second storage medium Corresponding index information obtains target index information, and target index information is read in the first storage medium, the first storage The reading and writing data performance of medium is higher than the reading and writing data performance of the second storage medium.
Searching module 504 is obtained for searching target index mark in target index information based on preset lookup algorithm To index to be found.
Wherein, as shown in fig. 6, on the basis of apparatus structure shown in Fig. 5, the index of the embodiment of the present invention searches device also May include:
Spider module 601, for traversing the index file being stored in the second storage medium in advance.
Abstraction module 602 is identified for extracting multiple indexes according to predetermined order interval from index file, as reference Index mark.
Wherein, as shown in fig. 7, determining module 502, comprising:
First determines submodule 5021, for determining the serial number in target index section.
Second determines submodule 5022, for determining target index section in index text based on the serial number in target index section Start offset amount in part.
Third determines submodule 5023, for determining the byte total amount for the index for including in target index section.
4th determines submodule 5024, for the byte based on the index for including in start offset amount and target index section Total amount determines target index information.
Wherein, it first determines submodule, is specifically used for:
The corresponding reference key in section is indexed according to target and identifies the sequence in multiple reference keys, determines that target indexes The serial number in section.
Wherein, the start offset amount O in target index section indexed file is determined based on the first default expression formula, first Default expression formula are as follows:
O=N*Q*S
In formula, N is the serial number that target indexes section, and Q is the quantity that target indexes the index for including in section, and S is every The byte quantity of index.
Wherein, the byte total amount TS for the index for including in target index section is determined based on the second default expression formula, second Default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that target indexes the index for including in section, and S is the byte quantity of every index.
Wherein, preset lookup algorithm can be any one of following methods: dichotomy, binary sort tree method, Hash Table method, block research method.
Wherein, the second storage medium is disk, and the first storage medium is memory.
A kind of index provided in an embodiment of the present invention searches device, after obtaining target index mark, by by target rope Multiple reference keys mark that tendering is known and is stored in advance in the first storage medium is compared, determining to identify with target index Corresponding target indexes section, and then determining and target indexes section pair from the index file being stored in the second storage medium The index information answered, and target index information is read in the first storage medium, entire index file is read with the prior art It compares, the index quantity that the embodiment of the present invention reads the target index information in the first storage medium greatly reduces, and then rope Draw read access time shortening, so as to shorten the lookup time of index.
The embodiment of the invention also provides a kind of electronic equipment, are specifically as follows server, as shown in figure 8, the equipment 800 Including processor 801 and machine readable storage medium 802, machine readable storage medium is stored with the machine that can be executed by processor Device executable instruction, processor execute machine-executable instruction and perform the steps of
Target index mark is obtained, target index is identified as the index mark of index to be found;
Target is indexed into mark based on default lookup algorithm and is stored in advance in multiple with reference to rope in the first storage medium Tendering knowledge is compared, and determining target corresponding with target index mark indexes section;
Index information corresponding with target index section is determined from the index file being stored in the second storage medium, is obtained It is read in the first storage medium to target index information, and by target index information, the reading and writing data of the first storage medium The reading and writing data performance of the second storage medium can be higher than;
Target index mark is searched in target index information based on preset lookup algorithm, obtains index to be found.
A kind of electronic equipment provided in an embodiment of the present invention is marked after obtaining target index mark by indexing target The multiple reference keys mark known and be stored in advance in the first storage medium is compared, determining corresponding with target index mark Target index section, and then determining from the index file being stored in the second storage medium with target to index section corresponding Index information, and target index information is read in the first storage medium, compared with the prior art reads entire index file, The index quantity that the embodiment of the present invention reads the target index information in the first storage medium greatly reduces, and then indexes and read Time shortens, so as to shorten the lookup time of index.
Above-mentioned machine readable storage medium may include random access memory (Random Access Memory, abbreviation It RAM), also may include nonvolatile memory (non-volatile memory), for example, at least a magnetic disk storage.It can Choosing, memory can also be that at least one is located remotely from the storage device of aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, Abbreviation CPU), network processing unit (Network Processor, abbreviation NP) etc.;It can also be digital signal processor (Digital Signal Processing, abbreviation DSP), specific integrated circuit (Application Specific Integrated Circuit, abbreviation ASIC), field programmable gate array (Field-Programmable Gate Array, Abbreviation FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components.
The embodiment of the invention provides a kind of computer readable storage medium, meter is stored in computer readable storage medium Calculation machine program, when computer program is executed by processor, to execute following steps:
Target index mark is obtained, target index is identified as the index mark of index to be found;
Target is indexed into mark based on default lookup algorithm and is stored in advance in multiple with reference to rope in the first storage medium Tendering knowledge is compared, and determining target corresponding with target index mark indexes section;
Index information corresponding with target index section is determined from the index file being stored in the second storage medium, is obtained It is read in the first storage medium to target index information, and by target index information, the reading and writing data of the first storage medium The reading and writing data performance of the second storage medium can be higher than;
Target index mark is searched in target index information based on preset lookup algorithm, obtains index to be found.
Computer readable storage medium provided in an embodiment of the present invention, after obtaining target index mark, by by target Index mark and the multiple reference keys mark being stored in advance in the first storage medium are compared, determining to mark with target index Know corresponding target index section, and then determining and target indexes section from the index file being stored in the second storage medium Corresponding index information, and target index information is read in the first storage medium, entire index text is read with the prior art Part is compared, and the index quantity that the embodiment of the present invention reads the target index information in the first storage medium greatly reduces, in turn It indexes read access time to shorten, so as to shorten the lookup time of index.
The embodiment of the invention provides a kind of computer program products comprising instruction, when run on a computer, So that computer executes following steps:
Target index mark is obtained, target index is identified as the index mark of index to be found;
Target is indexed into mark based on default lookup algorithm and is stored in advance in multiple with reference to rope in the first storage medium Tendering knowledge is compared, and determining target corresponding with target index mark indexes section;
Index information corresponding with target index section is determined from the index file being stored in the second storage medium, is obtained It is read in the first storage medium to target index information, and by target index information, the reading and writing data of the first storage medium The reading and writing data performance of the second storage medium can be higher than;
Target index mark is searched in target index information based on preset lookup algorithm, obtains index to be found.
Computer program product provided in an embodiment of the present invention comprising instruction passes through after obtaining target index mark Target is indexed into mark and the multiple reference keys being stored in advance in the first storage medium mark is compared, determining and target Index identifies corresponding target and indexes section, and then the determining and target rope from the index file being stored in the second storage medium Draw the corresponding index information in section, and target index information is read in the first storage medium, is read with the prior art entire Index file is compared, and the index quantity that the embodiment of the present invention reads the target index information in the first storage medium subtracts significantly It is few, and then index read access time and shorten, so as to shorten the lookup time of index.
The embodiment of the invention also provides a kind of computer programs, when run on a computer, so that computer is held Row following steps:
Target index mark is obtained, target index is identified as the index mark of index to be found;
Target is indexed into mark based on default lookup algorithm and is stored in advance in multiple with reference to rope in the first storage medium Tendering knowledge is compared, and determining target corresponding with target index mark indexes section;
Index information corresponding with target index section is determined from the index file being stored in the second storage medium, is obtained It is read in the first storage medium to target index information, and by target index information, the reading and writing data of the first storage medium The reading and writing data performance of the second storage medium can be higher than;
Target index mark is searched in target index information based on preset lookup algorithm, obtains index to be found.
Computer program provided in an embodiment of the present invention comprising instruction, after obtaining target index mark, by by mesh Mark index mark and the multiple reference keys mark being stored in advance in the first storage medium are compared, determining to index with target Identify corresponding target index section, and then the determining and target index area from the index file being stored in the second storage medium Between corresponding index information, and target index information is read in the first storage medium, reads entire index with the prior art File is compared, and the index quantity that the embodiment of the present invention reads the target index information in the first storage medium greatly reduces, into And read access time shortening is indexed, so as to shorten the lookup time of index.
For device/electronic equipment/storage medium embodiment, since it is substantially similar to the method embodiment, so It is described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (18)

1. a kind of index lookup method, which is characterized in that the described method includes:
Target index mark is obtained, the target index is identified as the index mark of index to be found;
The target is indexed into mark based on default lookup algorithm and is stored in advance in multiple with reference to rope in the first storage medium Tendering knowledge is compared, and determining target corresponding with target index mark indexes section;
Index information corresponding with target index section is determined from the index file being stored in the second storage medium, is obtained It is read in the first storage medium to target index information, and by the target index information, the number of first storage medium It is higher than the reading and writing data performance of second storage medium according to readwrite performance;
The target index mark is searched in the target index information based on preset lookup algorithm, is obtained described to be found Index.
2. the method according to claim 1, wherein reference key mark obtains by the following method:
The index file being stored in second storage medium is traversed in advance;
Multiple indexes are extracted according to predetermined order interval from the index file to identify, and are identified as the reference key.
3. the method according to claim 1, wherein described from the index file being stored in the second storage medium The step of corresponding index information in middle determination and the target index section, comprising:
Determine the serial number in target index section;
Start offset of the target index section in the index file is determined based on the serial number in target index section Amount;
Determine the byte total amount for the index for including in target index section;
The target rope is determined based on the byte total amount for the index for including in the start offset amount and target index section Fuse breath.
4. according to the method described in claim 3, it is characterized in that, determining the sequence in target index section by the following method Number: the corresponding reference key in section is indexed according to the target and identifies the sequence in the multiple reference key, determine described in The serial number in target index section.
5. according to the method described in claim 3, it is characterized in that, determining the target index area based on the first default expression formula Between start offset amount O in the index file, the first default expression formula are as follows:
O=N*Q*S
Wherein, N is the serial number that the target indexes section, and Q is the quantity that the target indexes the index for including in section, and S is The byte quantity of every index.
6. according to the method described in claim 3, it is characterized in that, determining the target index area based on the second default expression formula Between in include index byte total amount TS, the second default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that the target indexes the index for including in section, and S is the byte quantity of every index.
7. method according to claim 1-6, which is characterized in that the preset lookup algorithm can be following Any one of method: dichotomy, binary sort tree method, Hash table method, block research method.
8. method according to claim 1-6, which is characterized in that second storage medium is disk, described First storage medium is memory.
9. a kind of index searches device, which is characterized in that described device includes:
Module is obtained, for obtaining target index mark, the target index is identified as the index mark of index to be found;
Determining module, for the target to be indexed mark based on default lookup algorithm and is stored in advance in the first storage medium Multiple reference keys mark be compared, determining target index corresponding with target index mark section;
Read module, it is corresponding with target index section for being determined from the index file being stored in the second storage medium Index information, obtain target index information, and the target index information is read in the first storage medium, described first The reading and writing data performance of storage medium is higher than the reading and writing data performance of second storage medium;
Searching module, for searching the target index mark in the target index information based on preset lookup algorithm, Obtain the index to be found.
10. device according to claim 9, which is characterized in that described device further include:
Spider module, for traversing the index file being stored in second storage medium in advance;
Abstraction module is identified for extracting multiple indexes according to predetermined order interval from the index file, as the ginseng Examine index mark.
11. device according to claim 9, which is characterized in that the determining module, comprising:
First determines submodule, for determining the serial number in target index section;
Second determines submodule, for determining target index section in the rope based on the serial number in target index section Start offset amount in quotation part;
Third determines submodule, for determining the byte total amount for the index for including in target index section;
4th determines submodule, for the byte based on the index for including in the start offset amount and target index section Total amount determines the target index information.
12. device according to claim 11, which is characterized in that described first determines submodule, is specifically used for:
Index the corresponding reference key in section according to the target and identify the sequence in the multiple reference key, determine described in The serial number in target index section.
13. device according to claim 11, which is characterized in that determine that the target indexes based on the first default expression formula Start offset amount O of the section in the index file, the first default expression formula are as follows:
O=N*Q*S
Wherein, N is the serial number that the target indexes section, and Q is the quantity that the target indexes the index for including in section, and S is The byte quantity of every index.
14. device according to claim 11, which is characterized in that determine that the target indexes based on the second default expression formula The byte total amount TS for the index for including in section, the second default expression formula are as follows:
TS=Q*S
Wherein, Q is the quantity that the target indexes the index for including in section, and S is the byte quantity of every index.
15. according to the described in any item devices of claim 9-14, which is characterized in that the preset lookup algorithm can be with Any one of lower method: dichotomy, binary sort tree method, Hash table method, block research method.
16. according to the described in any item devices of claim 9-14, which is characterized in that second storage medium is disk, institute Stating the first storage medium is memory.
17. a kind of electronic equipment, which is characterized in that including processor and machine readable storage medium, the machine readable storage Media storage has the machine-executable instruction that can be executed by the processor, and the processor executes the executable finger of the machine Enable the method and step to realize the described in any item index lookup methods of claim 1-8.
18. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program realizes the side of the described in any item index lookup methods of claim 1-8 when the computer program is executed by processor Method step.
CN201910515781.0A 2019-06-14 2019-06-14 It indexes lookup method, search device, electronic equipment and storage medium Pending CN110222074A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910515781.0A CN110222074A (en) 2019-06-14 2019-06-14 It indexes lookup method, search device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910515781.0A CN110222074A (en) 2019-06-14 2019-06-14 It indexes lookup method, search device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110222074A true CN110222074A (en) 2019-09-10

Family

ID=67817375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910515781.0A Pending CN110222074A (en) 2019-06-14 2019-06-14 It indexes lookup method, search device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110222074A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110765321A (en) * 2019-10-28 2020-02-07 北京明略软件系统有限公司 Data storage path generation method and device and readable storage medium
CN111459883A (en) * 2020-03-31 2020-07-28 潍柴动力股份有限公司 Data processing method and device
CN113190507A (en) * 2021-05-14 2021-07-30 杭州海康威视数字技术股份有限公司 Index information synchronization method and device and electronic equipment
CN114661666A (en) * 2022-03-03 2022-06-24 北京城市网邻信息技术有限公司 Data searching method, device, equipment and storage medium
CN114978646A (en) * 2022-05-13 2022-08-30 京东科技控股股份有限公司 Access authority determination method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407250A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Information query method, device and system, server and client side
US20170270150A1 (en) * 2015-05-14 2017-09-21 Walleye Software, LLC Dynamic table index mapping
CN107391769A (en) * 2017-09-12 2017-11-24 北京优网助帮信息技术有限公司 A kind of search index method and device
CN108255958A (en) * 2017-12-21 2018-07-06 百度在线网络技术(北京)有限公司 Data query method, apparatus and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170270150A1 (en) * 2015-05-14 2017-09-21 Walleye Software, LLC Dynamic table index mapping
CN106407250A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Information query method, device and system, server and client side
CN107391769A (en) * 2017-09-12 2017-11-24 北京优网助帮信息技术有限公司 A kind of search index method and device
CN108255958A (en) * 2017-12-21 2018-07-06 百度在线网络技术(北京)有限公司 Data query method, apparatus and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110765321A (en) * 2019-10-28 2020-02-07 北京明略软件系统有限公司 Data storage path generation method and device and readable storage medium
CN111459883A (en) * 2020-03-31 2020-07-28 潍柴动力股份有限公司 Data processing method and device
CN111459883B (en) * 2020-03-31 2023-08-18 潍柴动力股份有限公司 Data processing method and device
CN113190507A (en) * 2021-05-14 2021-07-30 杭州海康威视数字技术股份有限公司 Index information synchronization method and device and electronic equipment
CN113190507B (en) * 2021-05-14 2022-06-03 杭州海康威视数字技术股份有限公司 Index information synchronization method and device and electronic equipment
CN114661666A (en) * 2022-03-03 2022-06-24 北京城市网邻信息技术有限公司 Data searching method, device, equipment and storage medium
CN114661666B (en) * 2022-03-03 2023-01-24 北京城市网邻信息技术有限公司 Data searching method, device, equipment and storage medium
CN114978646A (en) * 2022-05-13 2022-08-30 京东科技控股股份有限公司 Access authority determination method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110222074A (en) It indexes lookup method, search device, electronic equipment and storage medium
CN102402605B (en) Mixed distribution model for search engine indexing
RU2632133C2 (en) Method (versions) and system (versions) for creating prediction model and determining prediction model accuracy
US9317613B2 (en) Large scale entity-specific resource classification
CN100442284C (en) Search system for providing information of keyword input frequency by category and method thereof
US10346496B2 (en) Information category obtaining method and apparatus
CN104361042A (en) Information retrieval method and device
CN102169491B (en) Dynamic detection method for multi-data concentrated and repeated records
CN105956085B (en) A kind of construction method and device, search method and device of inverted index
Adamu et al. A survey on big data indexing strategies
CN105159925B (en) A kind of data-base cluster data distributing method and system
CN106484815B (en) A kind of automatic identification optimization method based on mass data class SQL retrieval scene
CN104636368A (en) Data retrieval method and device and server
CN113568940B (en) Method, device, equipment and storage medium for data query
CN107748772A (en) A kind of brand recognition method and device
CN108021713B (en) Document clustering method and device
CN102193988A (en) Method and system for retrieving node data in graphic database
CN103500222A (en) Method and device for searching for chat object through communication software
JP2010277329A (en) Neighborhood retrieval device
CN110909266B (en) Deep paging method and device and server
CN110825953B (en) Data query method, device and equipment
JP2011170461A (en) Information accumulation retrieval method and information accumulation retrieval program
RU2433467C1 (en) Method of forming aggregated data structure and method of searching for data through aggregated data structure in data base management system
CN105164671A (en) Using hierarchical scoring for disambiguation in an information retrieval system
CN114491232B (en) Information query method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190910

RJ01 Rejection of invention patent application after publication