CN108427748A - Distributed data base secondary index querying method, device and server - Google Patents
Distributed data base secondary index querying method, device and server Download PDFInfo
- Publication number
- CN108427748A CN108427748A CN201810201425.7A CN201810201425A CN108427748A CN 108427748 A CN108427748 A CN 108427748A CN 201810201425 A CN201810201425 A CN 201810201425A CN 108427748 A CN108427748 A CN 108427748A
- Authority
- CN
- China
- Prior art keywords
- secondary index
- value
- index field
- level
- inquiry request
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24553—Query execution of query operations
- G06F16/24554—Unary operations; Data partitioning operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2272—Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
An embodiment of the present invention provides a kind of distributed data base secondary index querying method, device, server and storage mediums, the secondary index inquiry request sent the method includes receiving terminal;According to the correspondence of the secondary index field value and pre-stored secondary index field value and level-one index word segment value that include in the secondary index inquiry request, the corresponding target level-one index word segment value of the secondary index inquiry request is obtained;The secondary index inquiry request is sent in the target partition corresponding to the target level-one index word segment value;The query result of the target partition feedback is received, and the query result is fed back into terminal.Use distributed data base secondary index querying method provided by the invention, inquiry only need to be carried out in corresponding subregion and can be obtained result, inquiry request need not be sent to each subregion again to summarize query result, the complexity of secondary index inquiry is reduced, improve efficiency.
Description
Technical field
The present invention relates to technical field of data administration, more particularly to a kind of distributed data base secondary index issuer
Method, device, server and storage medium.
Background technology
For distributed data base usually using the mode of partitioned storage, each subregion includes a part for database, referred to as
One subregion (shard).The foundation for carrying out subregion is fragment key assignments (sharding key), for example, some distributed data base
It is stored with student information, and student information is subjected to partitioned storage according to class, then the sharding key of this database
As class.In general, also referred to as this sharding key is the level-one index field of the distributed data base.One can be used simultaneously
Grade index word segment value indicates specific subregion.
In the prior art, it when database is needed according to secondary index Field Inquiry data, needs to send out the inquiry request
Give each subregion.For example, for above-mentioned example, when needing to inquire student information with student number, this time inquiry belongs to
It is inquired according to secondary index field, wherein student number is the secondary index field of this time inquiry, and the occurrence of student number claims
For the secondary index field value of this inquiry.It is this time inquired to realize, needs this inquiry request being sent to each root
According to the subregion that level-one index field is divided, specific student information can just be found by then summarizing the result of inquiry.It is this
Inquiry mode is complex, less efficient.
Invention content
The embodiment of the present invention is designed to provide a kind of distributed data base secondary index querying method, device, service
Device and storage medium improve search efficiency to realize the complexity for reducing distributed data base and carrying out secondary index inquiry.
In order to achieve the above objectives, it the embodiment of the invention discloses a kind of distributed data base secondary index querying method, answers
For database server, the method includes:
Receive the secondary index inquiry request that terminal is sent;Include the two of this inquiry in the secondary index inquiry request
Grade index word segment value;
According to the secondary index field value and pre-stored secondary index for including in the secondary index inquiry request
The correspondence of field value and level-one index word segment value obtains the corresponding target level-one index word of the secondary index inquiry request
Segment value;
The secondary index inquiry request is sent in the target partition corresponding to the target level-one index word segment value;
The query result of the target partition feedback is received, and the query result is fed back into terminal.
Optionally, the step of prestoring correspondence of the secondary index field value with level-one index word segment value, packet
It includes:
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
Store the correspondence of the secondary index field value and level-one index word segment value of the acquisition.
Optionally, after receiving the secondary index inquiry request that terminal is sent, further include:
Judge whether the corresponding secondary index field of the secondary index inquiry request is preset secondary index field;
If so, executing according to the secondary index field value for including in the secondary index inquiry request and prestoring
Secondary index field value and level-one index word segment value correspondence, obtain the corresponding target of the secondary index inquiry request
The step of level-one index word segment value;
If it is not, then using all subregions as target partition, the secondary index inquiry request is sent to each target point
Area.
The embodiment of the present invention additionally provides a kind of distributed data base secondary index construction method, is applied to database service
Device, the method includes:
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
The correspondence of storage acquired secondary index field value and level-one index word segment value.
An embodiment of the present invention provides a kind of distributed data base secondary index inquiry units, are applied to database service
Device, described device include:
Secondary index inquiry request receiving module:Secondary index inquiry request for receiving terminal transmission;The two level
Include the secondary index field value of this inquiry in search index request;
Level-one index word segment value acquisition module:For according to the secondary index word for including in the secondary index inquiry request
The correspondence of segment value and pre-stored secondary index field value and level-one index word segment value obtains the secondary index and looks into
It askes and asks corresponding target level-one index word segment value;
Inquiry request forwarding module:For the secondary index inquiry request to be sent to the target level-one index field
In the corresponding target partition of value;
Query result receiving module:Query result for receiving target partition feedback, and by the query result
Feed back to terminal.
Optionally, described device further includes:
Operation log obtains module:The operation log for including preset secondary index field for obtaining each;It is described
The value of preset secondary index field correspond sample in entire database;
Parsing module:Operation log for including preset secondary index field by parsing each, obtains
The correspondence of the secondary index field value and level-one index word segment value that include in the operation log;
Memory module:For recording and depositing the correspondence of the secondary index field value of acquisition and level-one index word segment value
Storage.
Optionally, described device further includes:
Judgment module:For after receiving the secondary index inquiry request that terminal is sent, judging that the secondary index is looked into
It askes and asks whether corresponding secondary index field is preset secondary index field;If so, triggering level-one index word segment value obtains
Modulus block.
An embodiment of the present invention provides a kind of distributed data base secondary index construction devices, are applied to database service
Device, described device include:
Operation log obtains module:The operation log for including preset secondary index field for obtaining each;It is described
The value of preset secondary index field correspond sample in entire database;
Parsing module:Operation log for including preset secondary index field by parsing each, obtains
The correspondence of the secondary index field value and level-one index word segment value that include in the operation log;
Memory module:For recording and depositing the correspondence of the secondary index field value of acquisition and level-one index word segment value
Storage.
An embodiment of the present invention provides a kind of server, including processor, communication interface, memory and communication bus,
In, the processor, the communication interface, the memory complete mutual communication by the communication bus;
The memory, for storing computer program;
The processor, when for executing the program stored on the memory,
An embodiment of the present invention provides a kind of computer readable storage mediums, which is characterized in that the computer can
It reads to be stored with computer program in storage medium, when the computer program is executed by processor, realizes any of the above-described method step
Suddenly.
As it can be seen that using distributed data base secondary index querying method provided in an embodiment of the present invention, device, server with
And storage medium, when being inquired according to secondary index field value, can according to pre-stored secondary index field value with
The correspondence of level-one index word segment value obtains level-one index word segment value, since a level-one index word segment value corresponds to one point
Area, therefore need to only carry out inquiry in corresponding subregion and can be obtained result.In compared with the prior art, inquiry request is sent
To the mode that each subregion again summarizes query result, the complexity of secondary index inquiry is reduced, efficiency is improved.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously
Point.
Description of the drawings
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 technology description to be briefly described.
Fig. 1 is a kind of flow chart of distributed data base secondary index querying method provided in an embodiment of the present invention;
Fig. 2 is a kind of flow of another distributed data base secondary index querying method provided in an embodiment of the present invention
Figure;
Fig. 3 is a kind of flow chart of distributed data base secondary index construction method provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of distributed data base secondary index inquiry unit provided in an embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram of distributed data base secondary index construction device provided in an embodiment of the present invention;
Fig. 6 is the structural schematic diagram of server provided in an embodiment of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention is described.
In order to solve the problems in the existing technology, the embodiment of the invention discloses a kind of distributed data base two level ropes
Draw querying method, device, server and storage medium, the complexity that distributed data base carries out secondary index inquiry can be reduced
Degree improves search efficiency.
First, distributed data base secondary index querying method provided in an embodiment of the present invention is illustrated, referring to figure
1, Fig. 1 is a kind of flow chart of distributed data base secondary index querying method provided in an embodiment of the present invention.The method is answered
For database server, include the following steps:
Step S101:Receive the secondary index inquiry request that terminal is sent;Include this in the secondary index inquiry request
The secondary index field value of secondary inquiry;
First, the differentiation of level-one index and secondary index is illustrated:For example, being stored with student's letter for one
The distributed data base of breath is to carry out subregion according to class, then it is that level-one indexes to use " class " to be indexed inquiry
Inquiry, it is that secondary index is inquired to carry out inquiry using other indexes.
In embodiments of the present invention, when user will carry out secondary index inquiry in distributed data base, need with
Terminal used in family inputs a secondary index field value, and subsequent terminal can send secondary index inquiry request to server,
Wherein contain the secondary index field value of this time inquiry.Server can receive the secondary index inquiry request.
Step S102:According to the secondary index field value that includes in the secondary index inquiry request and pre-stored
The correspondence of secondary index field value and level-one index word segment value obtains the corresponding target of the secondary index inquiry request one
Grade index word segment value;
It, can be according to the secondary index word in secondary index inquiry request after server receives secondary index inquiry request
Segment value obtains corresponding level-one index word segment value.
Specifically, server is previously stored with the correspondence of secondary index field value and level-one index word segment value, certainly,
Since in specific implementation process, above-mentioned correspondence may be especially more, therefore store correspondence is also likely to be other one
A database, the present invention do not limit this.
Above-mentioned secondary index field value can be input to pre-stored secondary index field value and be indexed with level-one by server
The correspondence of field value can obtain the corresponding level-one index word segment value of above-mentioned secondary index field value, due to level-one
Index field is corresponding with subregion, therefore is able to confirm that out the corresponding subregion of the data of being inquired.
For example, the distributed data base for being stored with student information for one, be carry out subregion according to class, then,
For using " student number " to carry out the inquiry of student information, as secondary index is inquired.Assuming that using " 2013210586 " this
It number is inquired, is inputted in the correspondence of student number value and class, the corresponding class of above-mentioned student number, such as 10 can be obtained
Class, then can determine the information storage of the corresponding student of above-mentioned student number in 10 classes of corresponding subregions.
Step S103:The secondary index inquiry request is sent to the mesh corresponding to the target level-one index word segment value
It marks in subregion;
In step s 102, server gets the corresponding target level-one index field of the secondary index inquiry request
Value, and then determine target partition.Therefore, the above-mentioned data to be inquired there is in target partition, and server only needs will be upper
It states inquiry request and is sent to target partition and inquired.Without inquiry request is sent to each target partition.
It in the above example, will in the information storage for determining the corresponding student of student number after 10 classes of corresponding subregions
This time secondary index inquiry request is input to 10 classes of corresponding subregions.
Step S104:The query result of the target partition feedback is received, and the query result is fed back into terminal.
In step s 103, inquiry request is sent to target partition and inquired by server, and subsequent target partition will be looked into
It askes result and feeds back to server, query result is fed back to the terminal that user uses by server again.
As it can be seen that distributed data base secondary index querying method provided in an embodiment of the present invention, according to secondary index word
When segment value is inquired, it can be obtained according to the correspondence of pre-stored secondary index field value and level-one index word segment value
To level-one index word segment value, since a level-one index word segment value corresponds to a subregion, only need in corresponding subregion into
Row inquiry can be obtained result.In compared with the prior art, inquiry request is sent to each subregion and again summarizes query result
Mode, reduce secondary index inquiry complexity, improve efficiency.
In embodiments of the present invention, the correspondence of the secondary index field value and level-one index word segment value is prestored
The step of, including:
Obtain the operation log that each includes preset secondary index field;The value of preset secondary index field is one by one
Corresponding to the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains include in operation log two
The correspondence of grade index word segment value and level-one index word segment value;
Store the correspondence of the secondary index field value and level-one index word segment value that obtain.
In any type database, there are various operation logs.With common MySQL (relational data depositary managements
Reason system) for, wherein will include inquiry log, slow inquiry log, Update log etc..It is contained in some of operation logs
The information of secondary index field, parses it, can obtain the corresponding sharding key of some secondary index field value
Information namely level-one index word segment value.
Server includes each operation log of secondary index field by parsing, to obtain each operation log
In include secondary index field value and level-one index word segment value correspondence.And it is stored.
For example, for MySQL (Relational DBMS), one of which operation log is binlog (two
System daily record), it has recorded the variation of data in database.For example, some and the relevant data of secondary index field are stored in
In some subregion, this data variation can be recorded in some binlog, by the above-mentioned two level rope for including in the binlog
The correspondence for drawing the value of field and the value of subregion extracts, and stores.
In embodiments of the present invention, server can also only carry out the operation log comprising preset secondary index field
Parsing, wherein the value of preset secondary index field all corresponds the sample in entire database.
For example, the distributed data base for being stored with student information for one, is to carry out subregion according to class, then right
In the database, level-one index field is exactly " class ", the field that can be used for retrieving student information other than " class "
It is secondary index field.For example, for " student number " this index field, as secondary index field, due to each student number
It corresponds in a student, therefore, server can parse the operation log comprising " student number ", " be learned to obtain
Number " value and " class " correspondence.When if desired carrying out secondary index inquiry according to some student number, it is only necessary to according to above-mentioned
Correspondence obtains the corresponding class of the student number, you can is inquired in the corresponding subregion of class, without in each subregion
All inquired.
On the basis of embodiment shown in Fig. 1, the present invention also provides the inquiries of another distributed data base secondary index
Method, it is after step slol, further comprising the steps of referring to Fig. 2:
Step S201:Judge whether the corresponding secondary index field of secondary index inquiry request is preset secondary index word
Section;If so, thening follow the steps S102;If not, thening follow the steps S202.
In embodiments of the present invention, since the secondary index field value having is corresponded in level-one index word segment value,
And some secondary index field values can not be corresponded in level-one index word segment value, those cannot be corresponded in level-one index word
The secondary index of section can not be retrieved using the above method, therefore can be preassigned and can be retrieved using the above method
Secondary index field.
For example, for " student number " this index field, due to student number can correspond with a student, " learn
Number " this index field can be used as preset secondary index field.
And for " student province " this index field, since student province cannot be corresponded in a student,
" student province " this index field cannot be used as preset secondary index field, and server also need not be to including " student
The operation log in province " is parsed.
Many preset secondary index fields are can be obtained according to above-mentioned rule, then in the two level for receiving terminal transmission
After search index request, it can also first judge whether the corresponding secondary index field of secondary index inquiry request is preset two
Grade index field, if so, being carried out according to method and step shown in FIG. 1.
If judging, the corresponding secondary index field of secondary index inquiry request is not preset secondary index field, should
Secondary index inquiry can not be carried out using method and step shown in FIG. 1, in such a case, it is possible to execute step S202:To own
Subregion is sent to each target partition as target partition, by secondary index inquiry request.
Step S104 is then executed, target partition is all subregions at this time, that is, receives looking into for each subregion feedback
It askes as a result, and query result is fed back to terminal.
The embodiment of the present invention additionally provides a kind of distributed data base secondary index construction method, is applied to database service
Device, as shown in figure 3, including the following steps:
Step S301:Obtain the operation log that each includes preset secondary index field;The preset two level
The value of index field corresponds the sample in entire database;
Step S302:The operation log for including preset secondary index field by parsing each, described in acquisition
The correspondence of the secondary index field value and level-one index word segment value that include in operation log;
Step S303:The correspondence of storage acquired secondary index field value and level-one index word segment value.
Distributed data base secondary index construction method provided in an embodiment of the present invention is to comprising secondary index field
Operation log is parsed, and the correspondence of secondary index field value and level-one index word segment value is extracted, and these are corresponded to
Relationship stores.
Wherein, secondary index field value corresponds the sample in entire database;The two level for being included for those
Index word segment value cannot correspond the operation log of the sample in entire database, it may not be necessary to be parsed.
Correspondingly, an embodiment of the present invention provides distributed data base secondary index inquiry unit, it is applied to database and takes
Business device, may refer to Fig. 4, comprises the following modules:
Secondary index inquiry request receiving module 401:Secondary index inquiry request for receiving terminal transmission;Described two
Include the secondary index field value of this inquiry in grade search index request;
Level-one index word segment value acquisition module 402:For according to the two level rope for including in the secondary index inquiry request
The correspondence for drawing field value and pre-stored secondary index field value and level-one index word segment value obtains the two level rope
Draw the corresponding target level-one index word segment value of inquiry request;
Inquiry request forwarding module 403:It is indexed for the secondary index inquiry request to be sent to the target level-one
In target partition corresponding to field value;
Query result receiving module 404:Query result for receiving the target partition feedback, and the inquiry is tied
Fruit feeds back to terminal.
Using distributed data base secondary index inquiry unit provided in an embodiment of the present invention, according to secondary index field
When value is inquired, it can be obtained according to the correspondence of pre-stored secondary index field value and level-one index word segment value
Level-one index word segment value need to only be carried out since a level-one index word segment value corresponds to a subregion in corresponding subregion
Inquiry can be obtained result.In compared with the prior art, inquiry request is sent to what each subregion again summarized query result
Mode reduces the complexity of secondary index inquiry, improves efficiency.
In an embodiment of the present invention, device shown in Fig. 4 can also include:
Operation log obtains module:The operation log for including preset secondary index field for obtaining each;It is described
The value of preset secondary index field correspond sample in entire database;
Parsing module:Operation log for including preset secondary index field by parsing each, obtains
The correspondence of the secondary index field value and level-one index word segment value that include in the operation log;
Memory module:For recording and depositing the correspondence of the secondary index field value of acquisition and level-one index word segment value
Storage.
In another embodiment provided by the invention, device shown in Fig. 4 can also include:
Judgment module:For after receiving the secondary index inquiry request that terminal is sent, judging that the secondary index is looked into
It askes and asks whether corresponding secondary index field is preset secondary index field;If so, triggering level-one index word segment value obtains
Modulus block.
The embodiment of the present invention additionally provides a kind of distributed data base secondary index construction device, may refer to Fig. 5, described
Device includes:
Operation log obtains module 501:The operation log for including preset secondary index field for obtaining each;Institute
The value for the preset secondary index field stated corresponds the sample in entire database;
Parsing module 502:Operation log for including preset secondary index field by parsing each, is obtained
Take the correspondence of the secondary index field value and level-one index word segment value that include in the operation log;
Memory module 503:Secondary index field value and the correspondence of level-one index word segment value for that will obtain record
And it stores.
For device embodiments, due to its substantially similar and embodiment of the method, so description is fairly simple, it is related
Place illustrates referring to the part of embodiment of the method.
The embodiment of the present invention additionally provides a kind of server, may refer to Fig. 6, including processor 601, communication interface 602,
Memory 603 and communication bus 604, wherein the processor, the communication interface, the memory are total by the communication
Line completes mutual communication;
The memory, for storing computer program;
The processor when for executing the program stored on the memory, realizes following methods step:
Receive the secondary index inquiry request that terminal is sent;Include the two of this inquiry in the secondary index inquiry request
Grade index word segment value;
According to the secondary index field value and pre-stored secondary index for including in the secondary index inquiry request
The correspondence of field value and level-one index word segment value obtains the corresponding target level-one index word of the secondary index inquiry request
Segment value;
The secondary index inquiry request is sent in the target partition corresponding to the target level-one index word segment value;
The query result of the target partition feedback is received, and the query result is fed back into terminal.
The step of prestoring correspondence of the secondary index field value with level-one index word segment value, including:
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
Store the correspondence of the secondary index field value and level-one index word segment value of the acquisition.
After receiving the secondary index inquiry request that terminal is sent, further include:
Judge whether the corresponding secondary index field of the secondary index inquiry request is preset secondary index field;
If so, executing according to the secondary index field value for including in the secondary index inquiry request and prestoring
Secondary index field value and level-one index word segment value correspondence, obtain the corresponding target of the secondary index inquiry request
The step of level-one index word segment value;
If it is not, then using all subregions as target partition, the secondary index inquiry request is sent to each target point
Area.
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
The correspondence of storage acquired secondary index field value and level-one index word segment value.
The embodiment of the present invention additionally provides a kind of computer readable storage medium, the computer readable storage medium memory
Computer program is contained, following methods step is realized when the computer program is executed by processor:
Receive the secondary index inquiry request that terminal is sent;Include the two of this inquiry in the secondary index inquiry request
Grade index word segment value;
According to the secondary index field value and pre-stored secondary index for including in the secondary index inquiry request
The correspondence of field value and level-one index word segment value obtains the corresponding target level-one index word of the secondary index inquiry request
Segment value;
The secondary index inquiry request is sent in the target partition corresponding to the target level-one index word segment value;
The query result of the target partition feedback is received, and the query result is fed back into terminal.
The step of prestoring correspondence of the secondary index field value with level-one index word segment value, including:
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
Store the correspondence of the secondary index field value and level-one index word segment value of the acquisition.
After receiving the secondary index inquiry request that terminal is sent, further include:
Judge whether the corresponding secondary index field of the secondary index inquiry request is preset secondary index field;
If so, executing according to the secondary index field value for including in the secondary index inquiry request and prestoring
Secondary index field value and level-one index word segment value correspondence, obtain the corresponding target of the secondary index inquiry request
The step of level-one index word segment value;
If it is not, then using all subregions as target partition, the secondary index inquiry request is sent to each target point
Area.
Obtain the operation log that each includes preset secondary index field;The preset secondary index field
Value corresponds the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log
Including secondary index field value and level-one index word segment value correspondence;
The correspondence of storage acquired secondary index field value and level-one index word segment value.
The communication bus that above-mentioned server is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, controlling bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned server and other servers or equipment.
Memory may include random access memory (Random Access Memory, RAM), can also include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be at least one storage device for being located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or its arbitrary combination real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.Computer program product
Including one or more computer instructions.When loading on computers and executing computer program instructions, all or part of real estate
Raw flow or function according to the embodiment of the present invention.Computer can be all-purpose computer, special purpose computer, computer network,
Or other programmable devices.Computer instruction can store in a computer-readable storage medium, or from a computer
Readable storage medium storing program for executing to another computer readable storage medium transmit, for example, computer instruction can from a web-site,
Computer, server or data center by wired (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as
Infrared, wireless, microwave etc.) mode is transmitted to another web-site, computer, server or data center.Computer
Readable storage medium storing program for executing can be that any usable medium that computer can access either includes one or more usable medium collection
At the data storage devices such as server, data center.Usable medium can be magnetic medium, (for example, floppy disk, hard disk, magnetic
Band), optical medium (for example, DVD) or semiconductor medium (such as solid state disk Solid State Disk (SSD)) etc..
It should be noted that herein, 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 include 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, identical similar portion between each embodiment
Point just to refer each other, and each embodiment focuses on the differences from other embodiments.Especially for device,
For electronic equipment, computer readable storage medium and computer program product embodiments, since it is substantially similar to method
Embodiment, so description is fairly simple, the relevent part can refer to the partial explaination of embodiments of method.
Claims (10)
1. a kind of distributed data base secondary index querying method, which is characterized in that be applied to database server, the method
Including:
Receive the secondary index inquiry request that terminal is sent;Include the two level rope of this inquiry in the secondary index inquiry request
Draw field value;
According to the secondary index field value and pre-stored secondary index field for including in the secondary index inquiry request
The correspondence of value and level-one index word segment value, obtains the corresponding target level-one index field of the secondary index inquiry request
Value;
The secondary index inquiry request is sent in the target partition corresponding to the target level-one index word segment value;
The query result of the target partition feedback is received, and the query result is fed back into terminal.
2. according to the method described in claim 1, being indexed with level-one it is characterized in that, prestoring the secondary index field value
The step of correspondence of field value, including:
Obtain the operation log that each includes preset secondary index field;The value one of the preset secondary index field
One corresponds to the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log and includes
Secondary index field value and level-one index word segment value correspondence;
Store the correspondence of the secondary index field value and level-one index word segment value of the acquisition.
3. according to the method described in claim 2, it is characterized in that, receive terminal send secondary index inquiry request it
Afterwards, further include:
Judge whether the corresponding secondary index field of the secondary index inquiry request is preset secondary index field;
If the corresponding secondary index field of the secondary index inquiry request is preset secondary index field, basis is executed
The secondary index field value and pre-stored secondary index field value and level-one for including in the secondary index inquiry request
The correspondence of index word segment value, the step of obtaining the secondary index inquiry request corresponding target level-one index word segment value;
Alternatively, if the corresponding secondary index field of the secondary index inquiry request is not preset secondary index field,
Using all subregions as target partition, the secondary index inquiry request is sent to each target partition.
4. a kind of distributed data base secondary index construction method, which is characterized in that be applied to database server, the method
Including:
Obtain the operation log that each includes preset secondary index field;The value one of the preset secondary index field
One corresponds to the sample in entire database;
The operation log for including preset secondary index field by parsing each, obtains in the operation log and includes
Secondary index field value and level-one index word segment value correspondence;
The correspondence of storage acquired secondary index field value and level-one index word segment value.
5. a kind of distributed data base secondary index inquiry unit, which is characterized in that be applied to database server, described device
Including:
Secondary index inquiry request receiving module:Secondary index inquiry request for receiving terminal transmission;The secondary index
Include the secondary index field value of this inquiry in inquiry request;
Level-one index word segment value acquisition module:For according to the secondary index field value for including in the secondary index inquiry request
And the correspondence of pre-stored secondary index field value and level-one index word segment value, it obtains the secondary index inquiry and asks
Seek corresponding target level-one index word segment value;
Inquiry request forwarding module:For the secondary index inquiry request to be sent to target level-one index word segment value institute
In corresponding target partition;
Query result receiving module:Query result for receiving the target partition feedback, and the query result is fed back
To terminal.
6. device according to claim 5, which is characterized in that described device further includes:
Operation log obtains module:The operation log for including preset secondary index field for obtaining each;Described is pre-
If the value of secondary index field correspond sample in entire database;
Parsing module:Operation log for including preset secondary index field by parsing each, described in acquisition
The correspondence of the secondary index field value and level-one index word segment value that include in operation log;
Memory module:For recording and storing the correspondence of the secondary index field value of acquisition and level-one index word segment value.
7. device according to claim 6, which is characterized in that described device further includes:
Judgment module:For after receiving the secondary index inquiry request that terminal is sent, judging that the secondary index inquiry is asked
Ask whether corresponding secondary index field is preset secondary index field;If so, triggering level-one index word segment value obtains mould
Block.
8. a kind of distributed data base secondary index construction device, which is characterized in that be applied to database server, described device
Including:
Operation log obtains module:The operation log for including preset secondary index field for obtaining each;Described is pre-
If the value of secondary index field correspond sample in entire database;
Parsing module:Operation log for including preset secondary index field by parsing each, described in acquisition
The correspondence of the secondary index field value and level-one index word segment value that include in operation log;
Memory module:For recording and storing the correspondence of the secondary index field value of acquisition and level-one index word segment value.
9. a kind of server, which is characterized in that including processor, communication interface, memory and communication bus, wherein the place
Reason device, the communication interface, the memory complete mutual communication by the communication bus;
The memory, for storing computer program;
The processor when for executing the program stored on the memory, realizes any sides claim 1-4
Method step.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium
Program realizes claim 1-4 any method and steps when the computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810201425.7A CN108427748A (en) | 2018-03-12 | 2018-03-12 | Distributed data base secondary index querying method, device and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810201425.7A CN108427748A (en) | 2018-03-12 | 2018-03-12 | Distributed data base secondary index querying method, device and server |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108427748A true CN108427748A (en) | 2018-08-21 |
Family
ID=63157840
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810201425.7A Pending CN108427748A (en) | 2018-03-12 | 2018-03-12 | Distributed data base secondary index querying method, device and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108427748A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109086456A (en) * | 2018-08-31 | 2018-12-25 | 中国联合网络通信集团有限公司 | data index method and device |
CN110457363A (en) * | 2019-07-05 | 2019-11-15 | 中国平安人寿保险股份有限公司 | Querying method, device and storage medium based on distributed data base |
CN110647562A (en) * | 2019-09-29 | 2020-01-03 | 中国联合网络通信集团有限公司 | Data query method and device, electronic equipment and storage medium |
CN110750515A (en) * | 2019-09-25 | 2020-02-04 | 浙江大华技术股份有限公司 | Database query method and processing device |
CN110955665A (en) * | 2019-12-03 | 2020-04-03 | 支付宝(杭州)信息技术有限公司 | Cache query method and device and electronic equipment |
CN111008182A (en) * | 2019-11-07 | 2020-04-14 | 中国电信集团工会上海市委员会 | Variable field log type data query method and system |
CN111008200A (en) * | 2019-12-18 | 2020-04-14 | 北京数衍科技有限公司 | Data query method and device and server |
CN112835938A (en) * | 2021-02-23 | 2021-05-25 | 百度在线网络技术(北京)有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN114185934A (en) * | 2021-12-15 | 2022-03-15 | 广州辰创科技发展有限公司 | Indexing and query method and system based on Tiandun database column storage |
CN117539962A (en) * | 2024-01-09 | 2024-02-09 | 腾讯科技(深圳)有限公司 | Data processing method, device, computer equipment and storage medium |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101650741A (en) * | 2009-08-27 | 2010-02-17 | 中国电信股份有限公司 | Method and system for updating index of distributed full-text search in real time |
CN101727465A (en) * | 2008-11-03 | 2010-06-09 | 中国移动通信集团公司 | Methods for establishing and inquiring index of distributed column storage database, device and system thereof |
CN103177116A (en) * | 2013-04-08 | 2013-06-26 | 国电南瑞科技股份有限公司 | Distributed log handling and inquiring method based on two-stage index |
CN103729386A (en) * | 2012-10-16 | 2014-04-16 | 阿里巴巴集团控股有限公司 | Information query system and method |
CN105512200A (en) * | 2015-11-26 | 2016-04-20 | 华为技术有限公司 | Distributed database processing method and device |
CN105787118A (en) * | 2016-03-25 | 2016-07-20 | 武汉工程大学 | Design method and query method for HBase secondary index |
US20160371337A1 (en) * | 2015-06-18 | 2016-12-22 | International Business Machines Corp. | Partitioned join with dense inner table representation |
CN106599040A (en) * | 2016-11-07 | 2017-04-26 | 中国科学院软件研究所 | Layered indexing method and search method for cloud storage |
CN106802891A (en) * | 2015-11-26 | 2017-06-06 | 中国电信股份有限公司 | The querying method of the non-burst field of distributed data base, system and equipment |
CN107783980A (en) * | 2016-08-24 | 2018-03-09 | 阿里巴巴集团控股有限公司 | Index data generates and data query method and device, storage and inquiry system |
-
2018
- 2018-03-12 CN CN201810201425.7A patent/CN108427748A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727465A (en) * | 2008-11-03 | 2010-06-09 | 中国移动通信集团公司 | Methods for establishing and inquiring index of distributed column storage database, device and system thereof |
CN101650741A (en) * | 2009-08-27 | 2010-02-17 | 中国电信股份有限公司 | Method and system for updating index of distributed full-text search in real time |
CN103729386A (en) * | 2012-10-16 | 2014-04-16 | 阿里巴巴集团控股有限公司 | Information query system and method |
CN103177116A (en) * | 2013-04-08 | 2013-06-26 | 国电南瑞科技股份有限公司 | Distributed log handling and inquiring method based on two-stage index |
US20160371337A1 (en) * | 2015-06-18 | 2016-12-22 | International Business Machines Corp. | Partitioned join with dense inner table representation |
CN105512200A (en) * | 2015-11-26 | 2016-04-20 | 华为技术有限公司 | Distributed database processing method and device |
CN106802891A (en) * | 2015-11-26 | 2017-06-06 | 中国电信股份有限公司 | The querying method of the non-burst field of distributed data base, system and equipment |
CN105787118A (en) * | 2016-03-25 | 2016-07-20 | 武汉工程大学 | Design method and query method for HBase secondary index |
CN107783980A (en) * | 2016-08-24 | 2018-03-09 | 阿里巴巴集团控股有限公司 | Index data generates and data query method and device, storage and inquiry system |
CN106599040A (en) * | 2016-11-07 | 2017-04-26 | 中国科学院软件研究所 | Layered indexing method and search method for cloud storage |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109086456A (en) * | 2018-08-31 | 2018-12-25 | 中国联合网络通信集团有限公司 | data index method and device |
CN110457363A (en) * | 2019-07-05 | 2019-11-15 | 中国平安人寿保险股份有限公司 | Querying method, device and storage medium based on distributed data base |
CN110457363B (en) * | 2019-07-05 | 2023-11-21 | 中国平安人寿保险股份有限公司 | Query method, device and storage medium based on distributed database |
CN110750515A (en) * | 2019-09-25 | 2020-02-04 | 浙江大华技术股份有限公司 | Database query method and processing device |
CN110647562B (en) * | 2019-09-29 | 2022-04-26 | 中国联合网络通信集团有限公司 | Data query method and device, electronic equipment and storage medium |
CN110647562A (en) * | 2019-09-29 | 2020-01-03 | 中国联合网络通信集团有限公司 | Data query method and device, electronic equipment and storage medium |
CN111008182A (en) * | 2019-11-07 | 2020-04-14 | 中国电信集团工会上海市委员会 | Variable field log type data query method and system |
CN111008182B (en) * | 2019-11-07 | 2022-12-13 | 中国电信集团工会上海市委员会 | Variable field log type data query method and system |
CN110955665A (en) * | 2019-12-03 | 2020-04-03 | 支付宝(杭州)信息技术有限公司 | Cache query method and device and electronic equipment |
CN111008200A (en) * | 2019-12-18 | 2020-04-14 | 北京数衍科技有限公司 | Data query method and device and server |
CN111008200B (en) * | 2019-12-18 | 2024-01-16 | 北京数衍科技有限公司 | Data query method, device and server |
CN112835938A (en) * | 2021-02-23 | 2021-05-25 | 百度在线网络技术(北京)有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN114185934A (en) * | 2021-12-15 | 2022-03-15 | 广州辰创科技发展有限公司 | Indexing and query method and system based on Tiandun database column storage |
CN117539962A (en) * | 2024-01-09 | 2024-02-09 | 腾讯科技(深圳)有限公司 | Data processing method, device, computer equipment and storage medium |
CN117539962B (en) * | 2024-01-09 | 2024-05-14 | 腾讯科技(深圳)有限公司 | Data processing method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108427748A (en) | Distributed data base secondary index querying method, device and server | |
CN102857493B (en) | Content filtering method and device | |
CN107798038B (en) | Data response method and data response equipment | |
CN106982377B (en) | Barrage management method and device | |
CN110019080B (en) | Data access method and device | |
US10275742B2 (en) | Methods and devices for managing emails | |
CN107615277A (en) | System and method for inquiring about data source | |
CN105989076A (en) | Data statistical method and device | |
CN103064933A (en) | Data query method and system | |
CN108509501A (en) | A kind of inquiry processing method, server and computer readable storage medium | |
CN104125208A (en) | Data transmission method and data transmission device | |
CN103368992A (en) | Message push method and device | |
CN106506715A (en) | Domain name analytic method and device | |
CN105337837A (en) | Message transmitting method and device | |
CN108710681A (en) | File acquisition method, device, equipment and storage medium | |
US20190180057A1 (en) | Fingerprint-based configuration typing and classification | |
CN110201393A (en) | Configuration data storage method and device and electronic equipment | |
CN105429879A (en) | Flow table item querying method, flow table item querying equipment and flow table item querying system | |
CN107301215A (en) | A kind of search result caching method and device, searching method and device | |
CN106503008A (en) | File memory method and device and file polling method and apparatus | |
CN105490843A (en) | Information processing method and system | |
CN112419044A (en) | Credit auditing method, equipment, electronic device and storage medium | |
CN102938121A (en) | Method and device for releasing commodity information | |
CN110502692A (en) | Information retrieval method, device, equipment and storage medium based on search engine | |
CN110008173A (en) | A kind of method and device of data storage |
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: 20180821 |
|
RJ01 | Rejection of invention patent application after publication |