CN103902702B - A kind of data-storage system and storage method - Google Patents
A kind of data-storage system and storage method Download PDFInfo
- Publication number
- CN103902702B CN103902702B CN201410126243.XA CN201410126243A CN103902702B CN 103902702 B CN103902702 B CN 103902702B CN 201410126243 A CN201410126243 A CN 201410126243A CN 103902702 B CN103902702 B CN 103902702B
- Authority
- CN
- China
- Prior art keywords
- data
- index
- data entry
- storage
- entry
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
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/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; 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/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
Abstract
The invention discloses a kind of data-storage system and storage method, belongs to database processing technical field.This method includes:Index list is constructed according to the inquiry mode to the Data Entry in the first data storage;Each index in the index list is stored in the second data storage;First data storage is divided into multiple data fields, starts multiple first threads, each first thread is responsible for obtaining each Data Entry storage from one or more data fields of the first data storage into the second data storage;One or more associated Data Entry is determined according to the inquiry mode corresponding with each index, obtains the Data Entry identification list associated with index;The Data Entry identification list associated with each index is stored into the second data storage in association with the index name each indexed.The present invention can improve the search efficiency to business datum, and improve Data Entry and index data is written to the speed of the second data storage.
Description
Technical field
The invention belongs to database processing technical field, and in particular to a kind of data-storage system and storage method.
Background technology
The implementation of traditional data storage and access is generally based on relevant database or is based on nosql numbers
According to the distributed caching in storehouse.For relevant database implementation, data storage is in the disk of relevant database, application
Program accesses the data in database by sql sentences.Because the grammer of sql sentences is very flexible, therefore can support a variety of
Complex query under the conditions of sequence and a variety of packets, i.e., it can support the inquiry business of complexity.But relevant database needs
Data consistency is safeguarded, and safeguards a large amount of incidence relations, and data storage causes data query speed slow on hard disk, it is special
It is not that can have a strong impact on search efficiency in the case of high concurrent access.
For nosql database implementations, data are with key-value(key-value)To mode be stored in internal memory.
Under this implementation, because data storage is in internal memory, access speed is fast, and passes through standard api(Application programming connects
Mouthful)It is easy to use to obtain data.But this implementation can not support the complexity of a variety of sequences and multiple combinations condition well
Inquiry, the inquiry business of complexity can not be supported.
It can be seen that the implementation of above two data storage and access respectively has quality.And how to support complicated inquiry industry
Data access efficiency is improved on the premise of business, just turns into technical problem urgently to be resolved hurrily.
The content of the invention
In view of the above problems, it is proposed that the present invention so as to provide one kind overcome above mentioned problem or at least in part solve on
State the data-storage system and storage method of problem.
According to an aspect of the invention, there is provided a kind of date storage method, suitable for the first data storage will be come from
Data Entry store into the second data storage, this method includes:
It is every in index list according to the inquiry mode construction index list to the Data Entry in the first data storage
A kind of individual corresponding inquiry mode of index;
Each index in the index list is stored in the second data storage, wherein each index includes identifying the rope
The index name drawn;
First data storage is divided into multiple data fields, starts multiple first threads, each first thread be responsible for from
Each Data Entry is obtained in one or more data fields of first data storage, by acquired Data Entry storage to the
In two data storages, wherein in the second data storage, each Data Entry include Data Entry unique mark and
Associated data content;
One or more associated Data Entry is determined according to the inquiry mode corresponding with each index, and is determined
Unique mark of each Data Entry in the second data storage, obtain the Data Entry identification list associated with the index;
And
The Data Entry identification list associated with each index is stored in association with the index name each indexed
Into the second data storage.
Alternatively, the basis constructs index list, bag to the inquiry mode of the Data Entry in the first data storage
Include:
Sorted lists are established according to the sorting query mode to Data Entry, and according to the Querying by group side to Data Entry
Formula establishes group list;
Cartesian product is carried out according to sorted lists and group list, constructs the index list.
Alternatively, the basis inquiry mode corresponding with each index determines one or more associated data
Entry, and unique mark of each Data Entry in the second data storage is determined, obtain the data strip associated with the index
Mesh identification list, including:
Starting multiple second threads, each second thread is responsible for one or more of sorted lists sorting query mode,
Sorting data entry set corresponding be responsible for sorting query mode is determined from the first data storage;
Start multiple 3rd threads, each 3rd thread is responsible for one or more of index list index, from bearing
The one or more Data Entries associated with the index are determined in sorting data entry set corresponding to the index of duty, and are determined
Unique mark of each Data Entry in the second data storage, obtain the Data Entry identification list associated with the index.
Alternatively, the determination from sorting data entry set corresponding be responsible for index is associated with the index
One or more Data Entries, including:
Sorting data entry set is divided into multiple data blocks, starts multiple 4th threads, each 4th thread is responsible for
The one or more Data Entries associated with the index are determined from one or more data blocks.
Alternatively, the index name is identified including sorting query mode and identified with Querying by group mode;
In second data storage, the unique mark of each Data Entry is deposited for the Data Entry in the first data
Unique mark in reservoir, and data content are the content obtained after each field of Data Entry is serialized.
Alternatively, the index name also includes data key values type;
In second data storage, the unique mark of each Data Entry also includes data key values type, and
Data content is the content obtained after each field corresponding with data key values type of Data Entry is serialized;
Wherein, the data key values type is used to identify key value information, and the key assignments is the one or more of Data Entry
Field name.
Alternatively, methods described also includes:
The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments, wherein described
Key assignments is one or more field names of Data Entry;
Index name is determined according to inquiry mode, the data associated with index name are searched from the second data storage
Entry identification list, and associated data are obtained from the second data storage according to the Data Entry identification list found
Content;
The data content got serialize, and obtained in the content after serializing is gone corresponding with key assignments
Content returns to application server.
Alternatively, methods described also includes:
The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments;
Index name is determined according to inquiry mode and key assignments, searched from the second data storage associated with index name
Data Entry identification list, and obtained from the second data storage according to the Data Entry identification list found associated
Data content;
The data content got serialize, the content after serializing will be gone to return to application server.
Alternatively, the Data Entry in the first data storage is stored in a manner of relevant database;And
Index in second data storage using index name as key, using associated Data Entry identification list as value
Key-value mode is stored, and Data Entry using the unique mark of Data Entry as key, using associated data content as value
Key-value mode stored.
According to another aspect of the present invention, there is provided a kind of data-storage system, suitable for the first data storage will be come from
Data Entry store into the second data storage, the system includes:
Index list structural unit, suitable for constructing rope according to the inquiry mode to the Data Entry in the first data storage
Draw list, each index in index list corresponds to a kind of inquiry mode;
Index storage unit, suitable for storing each index in the index list in the second data storage, wherein often
Individual index includes the index name for identifying the index;
Data Entry memory cell, suitable for the first data storage is divided into multiple data fields, start multiple First Lines
Journey, each first thread is responsible for obtaining each Data Entry from one or more data fields of the first data storage, by institute
The Data Entry of acquisition is stored into the second data storage, wherein in the second data storage, each Data Entry includes
The unique mark of Data Entry and associated data content;And
Associative cell, suitable for determining one or more associated number according to the inquiry mode corresponding with each index
According to entry, and unique mark of each Data Entry in the second data storage is determined, obtain the data associated with the index
Entry identification list;
Wherein, the index storage unit be configured to by the Data Entry identification list associated with each index with it is every
The index name of individual index stores into the second data storage in association.
Alternatively, the index list structural unit is configured to:
Sorted lists are established according to the sorting query mode to Data Entry, and according to the Querying by group side to Data Entry
Formula establishes group list;
Cartesian product is carried out according to sorted lists and group list, constructs the index list.
Alternatively, the associative cell is configured to:
Starting multiple second threads, each second thread is responsible for one or more of sorted lists sorting query mode,
Sorting data entry set corresponding be responsible for sorting query mode is determined from the first data storage;
Start multiple 3rd threads, each 3rd thread is responsible for one or more of index list index, from bearing
The one or more Data Entries associated with the index are determined in sorting data entry set corresponding to the index of duty, and are determined
Unique mark of each Data Entry in the second data storage, obtain the Data Entry identification list associated with the index.
Alternatively, the associative cell is configured to:
Sorting data entry set is divided into multiple data blocks, starts multiple 4th threads, each 4th thread is responsible for
The one or more Data Entries associated with the index are determined from one or more data blocks.
Alternatively, the index name is identified including sorting query mode and identified with Querying by group mode;
In second data storage, the unique mark of each Data Entry is deposited for the Data Entry in the first data
Unique mark in reservoir, and data content are the content obtained after each field of Data Entry is serialized.
According to another aspect of the invention, there is provided a kind of data query system, including the first data storage, data hair
Cloth server and the second data storage, wherein, the data distribution server includes above-mentioned data-storage system.
According to the said one of the present invention or multiple technical schemes, synchronous calculating is replaced by using off-line calculation, and it is whole
The advantages of closing traditional Relational DataBase and nosql databases, both having met will to the function of business datum progress complex query
Ask, solve the problems, such as again relatively low based on traditional Relational DataBase search efficiency, in particular improve under high concurrent environment
Efficiency data query;Parallel computing is also used in off-line calculation, by parallel form by the first data storage
Data Entry and corresponding index data be written in the second data storage, the writing speed of data is greatly improved.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention,
And can be practiced according to the content of specification, and in order to allow above and other objects of the present invention, feature and advantage can
Become apparent, below especially exemplified by the embodiment of the present invention.
Brief description of the drawings
Fig. 1 shows the structural representation of data query system according to an embodiment of the invention;
Fig. 2 shows the structural representation of data-storage system according to an embodiment of the invention;
Fig. 3 shows the schematic flow sheet of date storage method according to an embodiment of the invention;And
Fig. 4 shows that the block parallel of data and index calculates schematic diagram in the embodiment of the present invention.
Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in accompanying drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
Fig. 1 shows the structural representation of data query system according to an embodiment of the invention.Reference picture 1, this hair
The data query system of bright embodiment can include:First data storage 100, the data of data distribution server 20 and second are deposited
Reservoir 300, wherein data distribution server 20 respectively with the first data storage 100 and the communication link of the second data storage 300
Connect, and data distribution server 20 includes data-storage system 200, i.e. data-storage system 200 resides in data publication service
In device 20.
Data-storage system 200 100 can obtain each Data Entry from the first data storage, by acquired number
According to entry storage into the second data storage 300, wherein in the second data storage 300, each Data Entry includes number
Unique mark and associated data content according to entry.Data-storage system 200 can also be according to the first data storage
The various inquiry modes construction index list of Data Entry in device 100(The corresponding a kind of inquiry of each index in index list
Mode), and each index in the index list is stored into the second data storage 300, wherein in the second data storage
In device 300, each index includes identifying the index name of the index and associated Data Entry identification list.
Data-storage system 200 can also use parallel computing by the Data Entry in the first data storage 100
Store into the second data storage 300, and/or, using parallel computing by each index storage in index list to the
In two data storages 300, in this way, improving data and indexing writing speed when being written to the second data storage.
According to the above-mentioned processing of data-storage system 200, equivalent to being previously-completed under various inquiry modes to first
The inquiry of Data Entry in data storage 100, and Query Result is stored in the second data storage 300, that is, use from
Line computation instead of traditional synchronous calculating.So, when application server 400 needs to inquire about in the first data storage 100
During Data Entry, Query Result directly can be obtained from the query interface of the second data storage 300 offer, due to not needing
Calculated in real time according to specific inquiry mode, therefore improve data query speed.Specifically, the query interface receives
During the inquiry request sent to application server 400, rope is first determined according to the inquiry mode information carried in the inquiry request
Draw title, then obtained according to index name from the second data storage 200 corresponding to Data Entry identification list, last root
Data Entry set corresponding to being obtained according to the Data Entry identification list got from the second data storage 200.
First data storage 100 can be relevant database, such as Oracle, DB2, Microsoft SQL
Server and MySQL etc.;Second data storage 200 can be the no sql databases of key-value mode, such as redis data
Storehouse.In such cases, the data query system just incorporates the advantages of traditional Relational DataBase and nosql databases, both full
Foot carries out the functional requirement of complex query to business datum, solves again relatively low based on traditional Relational DataBase search efficiency
The problem of, in particular improve the efficiency data query under high concurrent environment.Wherein, redis is a key-value storages system
System, it supports the value types of storage to include string(Character string)、list(Chained list)、set(Set)、sorted set(Have
Ordered sets)And hash(Hash)Type.These data types all support push/pop, add/remove and take common factor, union and
Difference set and operation is waited, and these operations are all atomicities.
The specific composition and operation principle of the data-storage system 200 in above-mentioned data query system are carried out in detail below
Description.
Fig. 2 shows the structural representation of data-storage system according to an embodiment of the invention.The data storage system
System 200 may reside within data distribution server 20, the data distribution server 20 respectively with the first data storage 100
Communicated to connect with the second data storage 300, by the data-storage system 200, can will come from the first data storage
100 Data Entry is stored into the second data storage 300, so as to complete the issue of data.Wherein, the first data storage
100 can be relevant database, such as Oracle, DB2, Microsoft SQL Server and MySQL etc.;Second data are deposited
Reservoir 200 can be the no sql databases of key-value mode, such as redis databases.
Reference picture 2, the data-storage system 200 of the embodiment of the present invention can include:Index list structural unit 210, rope
Draw memory cell 220, Data Entry memory cell 230 and associative cell 240.
In view of the use actual conditions to business datum, the data query mode used in reality be it is limited, because
This, index list structural unit 210 can be according to the various inquiry mode structures to the Data Entry in the first data storage 100
Make index list, that is to say, that index list includes multiple indexes, a kind of each corresponding inquiry mode of index.
Sorting query mode is generally comprised to the inquiry mode of Data Entry(order by)With Querying by group mode
(group by), and combination.Order by and group by quantity are limited, and most order
By with group by are used together, and therefore, index list structural unit 210 can be looked into first according to the sequence to Data Entry
Inquiry mode establishes sorted lists, and establishes group list according to the Querying by group mode to Data Entry, then, according to Sorted list
Table and group list carry out cartesian product, to construct the index list.Certainly, can also to the inquiry mode of Data Entry
It is other inquiry modes of the prior art, is even possible to other inquiry modes occurred, the embodiment of the present invention pair in the future
This is not limited.
After the construction complete index list of index list structural unit 210, index storage unit 220 can deposit in the second data
Each index in the index list is stored in reservoir 300, wherein each index include the mark index index name and
The Data Entry identification list associated with the index.In specific implementation, index storage unit 220 can be first by index name
As key(key)Store in second memory 300, corresponding value(vlaue)It is temporarily sky.Subsequently, associative cell 240 is passed through
After determining Data Entry identification list corresponding to index name, then using the Data Entry identification list as value and corresponding index
The associated storage of title is into the second data storage 300.For example, for redis databases, the type of corresponding value can be with
Using ordered set(sorted set), that is, what the Data Entry mark in the Data Entry identification list stored was ordered into, its
Order inquiry mode as corresponding to index is determined.
In one implementation, the index name identifies including sorting query mode(orderID)And Querying by group
Mode identifies(groupID).In another implementation, the index name includes data key values type, sorting query side
Formula identifies and Querying by group mode identifies.Wherein, the data key values type is used to identify key value information, and the key assignments is data
One or more field names of entry.In specific implementation, the data key values type can directly use the key assignments,
Can be the value after being encoded to key assignments, and the embodiment of the present invention is not limited to specific coded system.
For example, it is assumed that Data Entry has 4 fields, field name is respectively A, B, C, D, the key assignments of user's inquiry for A,
C }, then the value such as 2 after the data key values type can be { A, C } or be encoded to { A, C }.
Data Entry memory cell 230 is suitable to obtain each Data Entry from the first data storage 100, by acquired in
Data Entry store into the second data storage 300, wherein in the second data storage 300, each Data Entry bag
Include the unique mark of Data Entry and associated data content.Such as redis databases, each Data Entry be with
The unique mark of Data Entry is stored as key using associated data content as value.
To improve data processing speed, the first data storage 100 can be divided into more by Data Entry memory cell 230
Individual data field, and start multiple first threads, each first thread is responsible for one or more numbers from the first data storage 100
According to each Data Entry is obtained in area, acquired Data Entry is stored into the second data storage 300, i.e., multiple first
Data Entry in first data storage 100 is written in the second data storage 300 thread parallel.
In specific implementation, Data Entry memory cell 230 can first judge the number stored in the first data storage 100
Whether it is more than threshold value according to the quantity of entry, is then decided whether to perform multiple threads according to judged result.When Data Entry
When quantity is more than threshold value, the multiple threads are performed, otherwise, the multiple threads can not be performed.Wherein, the threshold value
It can be determined based on experience value with experiment.
When the index name identifies including sorting query mode to be identified with Querying by group mode, then deposited in the second data
In reservoir 300, the unique mark of each Data Entry is unique mark of the Data Entry in the first data storage 100,
Associated data content is the content obtained after each field of Data Entry is serialized.For example, when the first data
When memory 100 is relevant database, the unique mark can be the major key of Data Entry.
Wherein, serializing is carried out to each field of Data Entry to refer to:Each field of the Data Entry is taken out successively
Value, be combined into a sequence using the value of each field as a sequence Item, and between each sequence Item with separator for example
Comma is split;Or the value of each field of the Data Entry is taken out successively, by the title of each field and the value of field
A sequence is combined into as a sequence Item, and with decollator such as colon point between the title of field and the value of field
Cut, split between each sequence Item with separator such as comma.
For example, it is assumed that Data Entry has 4 fields, field name is respectively A, B, C, D, and corresponding field value is respectively a,
B, c, d, the then content obtained after being serialized are { a, b, c, d }, or are { A:A, B:B, C:C, D:d}.
When the index name includes data key values type, sorting query mode identifies and Querying by group mode identifies,
Then in the second data storage 300, the unique mark of each Data Entry is the Data Entry in the first data storage 100
In unique mark, associated data content is that Data Entry each field corresponding with data key values type is carried out into sequence
The content obtained after rowization.For example, when the first data storage 100 is relevant database, the unique mark can be number
According to the major key of entry.
For example, it is assumed that Data Entry has 4 fields, field name is respectively A, B, C, D, and corresponding field value is respectively a,
B, c, d, data key values type are { A, C }, then the content obtained after being serialized is { a, c }, or is { A:A, C:c}.
Associative cell 240 be suitable to determine to be associated according to the inquiry mode corresponding with each index one or more
Data Entry, and unique mark of each Data Entry in the second data storage 300 is determined, obtain associated with the index
Data Entry identification list.
A kind of each corresponding inquiry mode of index, for every kind of inquiry mode, associative cell 240 can construct to be looked into accordingly
Sentence is ask to obtain corresponding Data Entry from the first data storage 100.For example, work as first data storage
100 when being relevant database, and associative cell 240 can be according to inquiry mode constructing SQL statement, according to the SQL statement of construction
First data storage 100 is operated, so as to obtain Data Entry corresponding with the inquiry mode.SQL statement shows
Under such as:
Select*from table name sort by A group by B.
After associative cell 240 gets one or more Data Entries associated with the index, it is determined that each data strip
The major key of purpose unique mark, for example, Data Entry, so as to obtain the Data Entry identification list associated with the index, so
Afterwards, the index name that index storage unit 220 can be by the Data Entry identification list associated with each index with each indexing
Title stores into the second data storage 300 in association.In this way, just by the index stored in the second data storage and the rope
Data Entry set associative corresponding to drawing gets up.
To improve data processing speed, associative cell 240 can start multiple second threads, and each second thread is responsible for row
One or more of sequence table sorting query mode, the sorting query with being responsible for is determined from the first data storage 100
Sorting data entry set corresponding to mode;And starting multiple 3rd threads, each 3rd thread is responsible for one in index list
Individual or multiple indexes, one associated with the index is determined from sorting data entry set corresponding be responsible for index
Or multiple Data Entries, and unique mark of each Data Entry in the second data storage is determined, obtain related to the index
The Data Entry identification list of connection.
Further to improve data processing speed, sorting data entry set can also be divided into more by associative cell 240
Individual data block, starts multiple 4th threads, and each 4th thread is responsible for determining and the index phase from one or more data blocks
One or more Data Entries of association.In specific implementation, associative cell 240 can be first judged in sorting data entry set
The quantity of Data Entry whether be more than threshold value, then decided whether to perform multiple threads according to judged result.Work as data strip
When purpose quantity is more than threshold value, the multiple threads are performed, otherwise, the multiple threads can not be performed.Wherein, it is described
Threshold value can determine with experiment based on experience value.
Data-storage system 200 according to embodiments of the present invention, synchronous calculating is replaced by using off-line calculation, effectively
Improve the search efficiency of data.For example, can configuration querying interface, application service in second data storage 300
Device 400 need not access the first data storage 100 and be calculated in real time, but directly please with inquiry to obtain from query interface
Corresponding Data Entry is sought, in this way, avoiding the complicated inquiry computing to Data Entry in the first data storage 100, is carried
High inquiry velocity.
As it was previously stated, in one implementation, the index name of 300 storages is looked into including sequence in the second data storage
Inquiry mode identifies to be identified with Querying by group mode;In another implementation, the index name include data key values type,
Sorting query mode identifies to be identified with Querying by group mode.
Corresponding to two kinds of above-mentioned implementations, the mode that the query interface obtains inquiry data also has two kinds.One
In kind implementation, the process that query interface obtains data is:
The inquiry request from application server 400 is obtained, the inquiry request includes inquiry mode and key assignments;
Index name is determined according to inquiry mode, searched from the second data storage 300 associated with index name
Data Entry identification list, and correlation is obtained from the second data storage 300 according to the Data Entry identification list found
The data content of connection;
The data content got serialize, and obtained in the content after serializing is gone corresponding with key assignments
Content returns to application server 400.
Wherein, the inverse process that serializing is serializing is removed, it is easy before that it implements process those skilled in the art
The serialization process stated determines.
In another implementation, the process that query interface obtains data is:
The inquiry request from application server 400 is obtained, the inquiry request includes inquiry mode and key assignments;
Index name is determined according to inquiry mode and key assignments, searched and index name phase from the second data storage 300
The Data Entry identification list of association, and obtained according to the Data Entry identification list found from the second data storage 300
Take associated data content;
The data content got serialize, the content after serializing will be gone to return to application server 400.
One difference of two kinds of implementations is:In the first implementation, the content gone after serializing is whole
The content of Data Entry, it is also necessary to returned again to after therefrom obtaining content corresponding with key assignments to application server;It is real at second
In existing mode, the content gone after serializing is content corresponding with key assignments in Data Entry, can be directly returned to application service
Device.
Fig. 3 shows the schematic flow sheet of date storage method according to an embodiment of the invention, the data storage side
Method is suitable to store into the second data storage from the Data Entry of the first data storage, wherein the first data storage
Can be relevant database, for example, Oracle, DB2, Microsoft SQL Server and MySQL etc., the second data storage
Device can be the no sql databases of key-value mode, such as redis databases.
Reference picture 3, the data storage method can include:
Step S310, index list, index are constructed according to the inquiry mode to the Data Entry in the first data storage
Each index in list corresponds to a kind of inquiry mode;
Sorting query mode is generally comprised to the inquiry mode of Data Entry(order by)With Querying by group mode
(group by), and combination.Order by and group by quantity are limited, and most order
By with group by are used together, and therefore, can establish sorted lists in a manner of the first sorting query according to Data Entry,
And group list is established according to the Querying by group mode to Data Entry;Then, flute is carried out according to sorted lists and group list
Karr product, construct the index list.Certainly, the inquiry mode to Data Entry can also be that of the prior art other are looked into
Inquiry mode, is even possible to other inquiry modes occurred in the future, and the embodiment of the present invention is without limitation.
Step S320, each index in the index list is stored in the second data storage;
In the second data storage, each index includes the index name of the mark index and associated with the index
Data Entry identification list.In this step, can be first using index name as key(key)Store in second memory,
Corresponding value(vlaue)It is temporarily sky.After Data Entry identification list corresponding to index name is determined in subsequent steps,
Again using the Data Entry identification list storage associated with corresponding index name as value into second memory.For example,
For redis databases, the type of corresponding value can use ordered set(sorted set), that is, the data strip target that is stored
Know what the mark of the Data Entry in list was ordered into, its order inquiry mode as corresponding to index is determined.
In one implementation, the index name identifies including sorting query mode(orderID)And Querying by group
Mode identifies(groupID).In another implementation, the index name includes data key values type, sorting query side
Formula identifies and Querying by group mode identifies.Wherein, the data key values type is used to identify key value information, and the key assignments is data
One or more field names of entry.In specific implementation, the data key values type can directly use the key assignments,
Can be the value after being encoded to key assignments, and the embodiment of the present invention is not limited to specific coded system.
Step S330, each Data Entry is obtained from the first data storage, acquired Data Entry storage is arrived
In second data storage;
In the second data storage, each Data Entry includes the unique mark of Data Entry and associated data
Content.Such as redis databases, each Data Entry is using the unique mark of Data Entry as key, with what is be associated
Data content is stored as value.
To improve data processing speed, the first data storage can be divided into multiple data fields, and start multiple the
One thread, each first thread are responsible for obtaining each Data Entry from one or more data fields of the first data storage,
Acquired Data Entry is stored into the second data storage, i.e., multiple first threads are concurrently by the first data storage
In Data Entry be written in the second data storage.
In specific implementation, whether the quantity for the Data Entry that can first judge to store in the first data storage is more than threshold
Value, then decided whether to perform multiple threads according to judged result.When the quantity of Data Entry is more than threshold value, described in execution
Multiple threads, otherwise, the multiple threads can not be performed.Wherein, the threshold value can be true with experiment based on experience value
It is fixed.
When the index name identifies including sorting query mode to be identified with Querying by group mode, then deposited in the second data
In reservoir, the unique mark of each Data Entry is unique mark of the Data Entry in the first data storage, is associated
Data content be obtained content after each field of Data Entry is serialized.For example, when the first data storage
For relevant database when, the unique mark can be Data Entry major key.
When the index name includes data key values type, sorting query mode identifies and Querying by group mode identifies,
Then in the second data storage, the unique mark of each Data Entry for the Data Entry in the first data storage only
One mark, after Data Entry each field corresponding with data key values type is to be serialized to associated data content
Obtained content.For example, when the first data storage is relevant database, the unique mark can be the master of Data Entry
Key.
Step S340, one or more associated data strip is determined according to the inquiry mode corresponding with each index
Mesh, and unique mark of each Data Entry in the second data storage is determined, obtain the Data Entry associated with the index
Identification list;
A kind of each corresponding inquiry mode of index, for every kind of inquiry mode, can construct corresponding query statement come from
Corresponding Data Entry is obtained in first data storage.For example, when first data storage is relevant database
When, first data storage can be operated according to the SQL statement of construction according to inquiry mode constructing SQL statement,
So as to obtain Data Entry corresponding with the inquiry mode.
After getting one or more Data Entries associated with the index, each Data Entry is further determined
The major key of unique mark, for example, Data Entry, so as to obtain the Data Entry identification list associated with the index.
To improve data processing speed, multiple second threads can be started, each second thread is responsible in sorted lists
One or more sorting query modes, sequence corresponding be responsible for sorting query mode is determined from the first data storage
Data Entry set;And starting multiple 3rd threads, each 3rd thread is responsible for one or more of index list index, from
The one or more Data Entries associated with the index are determined in sorting data entry set corresponding be responsible for index,
And unique mark of each Data Entry in the second data storage is determined, obtain the Data Entry mark associated with the index
List.
Further to improve data processing speed, sorting data entry set can also be divided into multiple data blocks, opened
Move multiple 4th threads, each 4th thread be responsible for determining from one or more data blocks associated with the index one or
Multiple Data Entries.In specific implementation, it can first judge whether the quantity of Data Entry in sorting data entry set is big
In threshold value, then decided whether to perform multiple threads according to judged result.When the quantity of Data Entry is more than threshold value, perform
The multiple threads, otherwise, the multiple threads can not be performed.Wherein, the threshold value can based on experience value and examination
Test determination.
Step S350 is related with the index name each indexed by the Data Entry identification list associated to each index
The storage of connection ground is into the second data storage, in this way, just that the index stored in the second data storage is corresponding with the index
Data Entry set associative gets up.
Date storage method according to embodiments of the present invention, synchronous calculating is replaced by using off-line calculation, is effectively carried
The high search efficiency of data.For example, configuration querying interface, application server it can be not required in second data storage
Access the first data storage to be calculated in real time, but data corresponding with inquiry request are directly obtained from query interface
Entry, in this way, avoiding the complicated inquiry computing to Data Entry in the first data storage, improve inquiry velocity.
That is, the date storage method of the embodiment of the present invention can also comprise the following steps:
The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments, wherein described
Key assignments is one or more field names of Data Entry;
Index name is determined according to inquiry mode, the data associated with index name are searched from the second data storage
Entry identification list, and associated data are obtained from the second data storage according to the Data Entry identification list found
Content;
The data content got serialize, and obtained in the content after serializing is gone corresponding with key assignments
Content returns to application server.
Or the date storage method of the embodiment of the present invention can also comprise the following steps:
The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments;
Index name is determined according to inquiry mode and key assignments, searched from the second data storage associated with index name
Data Entry identification list, and obtained from the second data storage according to the Data Entry identification list found associated
Data content;
The data content got serialize, the content after serializing will be gone to return to application server.
An application example of the invention given below.
In the application example, car dealer makes a price reduction ranking list data storage in traditional relevant database,
The car data entry stored in the relevant database includes following field name:
DealerId SpecId SpecName SpecImage SeriesId SeriesName BrandId
FactoryId NewsId NewsType NewsTitle StartDate EndDate DTime Price
OriginalPrice PriceOffPercent OrdersLastMonth OrdersLastQuarter CreateTime
ModifyTime PID CID SID KindId NewsTemplateId serieslevel InventoryState
PriceScope EquipCarId PackageName PackagePrice IsRecommend PriceW IsLastWeek
3 Data Entries being exemplified below in the relevant database:
Data Entry 1:1104632012 sections of S53.0T Sportback~/upload/2013/7/19/l_
201307191945189324136.jpg2734 the existing car abundance highests preferential 9.46 of the Audi S5 of Audi S533 79 8,266,471 0
Ten thousand yuan of 2013-12-3100:00:00.0002014-01-0500:00:00.0002013-12-3110:35:33.723633400
728000 13 1951 2013-12-31 10:55:00 2013-12-31 10:55:00110000 110100 110105 1
2671390 4 0 70 0 0 0 64 1
Data Entry 2:1 10,771 2013 sections of S64.0TFSI~/upload/2013/4/19/l_
201304191833167634435.jpg2736 the existing car abundance highests preferential 6.93 of the Audi S6 of Audi S633 79 8,266,541 0
Ten thousand yuan of 2013-12-31 00:00:00.000 2014-01-0500:00:00.000 2013-12-31 10:37:
12.510988700 1058000 7 97 12013-12-31 10:55:00 2013-12-31 10:55:00
110000110100 110105 1 26714295 0 100 0 0 0 99 1
Data Entry 3:1122032012 sections of 30FSI are poly-talented~/upload/spec/12203/l_
201207041848360214178.jpg18 the existing car abundance highests preferential 11.13 of the Audi A6L of Audi A6L33 9 8,266,413 0
Ten thousand yuan of 2013-12-31 00:00:00.000 2014-01-0500:00:00.000 2013-12-3110:34:25.467
380900 432800 12 1700 5 2013-12-24 18:55:00 2013-12-3110:55:00 110000110100
110105 1 2671359 5 0 50 0 0 0 39 1
The process issued to above-mentioned price reduction ranking list data is as follows:
(1)According to the inquiry mode to Data Entry in the price reduction ranking list data, sorted lists are constructed(Order by)
It is as follows:
As can be seen that in the sorted lists constructed, include 8 kinds of sorting query modes.
Construct group list(group by)It is as follows
new string[]{"BrandId","SeriesId","SpecId","PID","CID","BrandId,
PID","BrandId,CID","SeriesId,PID","SeriesId,CID","SpecId,PID","SeriesLevel"}
As can be seen that in the group list constructed, include 11 kinds of Querying by group modes.
Then, to the two progress cartesian product, multiple combinations are obtained, number of combinations is 8*11=88, i.e., in index list
Including 88 indexes, corresponding 88 kinds of inquiry modes.
(2)It is stored in every kind of querying condition as the key of index in redis databases, then key is:
"Promotion(PriceOffPercent desc,LessPrice desc,DTime desc|SpecId,
PID)"
Corresponding sorting query condition:
"PriceOffPercent desc,LessPrice desc,DTime desc"
Corresponding Querying by group condition:
"SpecId,PID"
(3)In redis databases in a manner of key-value data storage entry key values and value values, example is such as
Under:
Key:"Promotion_urn:promotion:92540000014492"
Value:"{\"DealerId\":9254,\"SpecId\":14492,\"SpecName\":\"2013\xe6\
xac\xbe1.6L\xe6\x89\x8b\xe5\x8a\xa8\xe8\x88\x92\xe9\x80\x82\xe7\x89\x88\",\"
SpecImage\":"~/upload/2013/5/15/l_201305151900310633686.jpg ", " SeriesId ":
145,\"SeriesName\":\"POLO\",\"SeriesLevel\":2,\"BrandId\":1,\"FactoryId\":
58,\"NewsId\":8313674,\"NewsType\":0,\"NewsTitle\":\"POLO\xe5\xb0\x91\xe9\
x87\x8f\xe7\x8e\xb0\xe8\xbd\xa6\xe6\x9c\x80\xe9\xab\x98\xe4\xbc\x98\xe6\x83\
xa00.5\xe4\xb8\x87\xe5\x85\x83\",\"StartDate\":\"\\/Date(1388505600000+
0800)\\/\",\"EndDate\":\"\\/Date(1391097600000+0800)\\/\",\"DTime\":\"\\/Date
(1388643961877+0800)\\/\",\"Price\":94900,\"OriginalPrice\":99900,\"
PriceOffPercent\":5,\"OrdersLastMonth\":1178,\"OrdersLastQuarter\":0,\"
CreateTime\":\"\\/Date(1385864760000+0800)\\/\",\"ModifyTime\":\"\\/Date
(1388645760000+0800)\\/\",\"PID\":210000,\"CID\":210300,\"SID\":210303,\"
KindId\":1,\"NewsTemplateId\":2699366,\"InventoryState\":1,\"PriceW\":10,\"
PriceScope\":10,\"EquipCarId\":0,\"PackagePrice\":0,\"IsRecommend\":0,\"
IsLastWeek\":1}"
Wherein, value values are to be serialized to generate according to type of service Promotion, and the partial code serialized is such as
Under:
(4)According to(2)Inquiry mode corresponding to the key acquisitions of middle generation, according to the inquiry mode got, from relationship type
Data Entry corresponding with the inquiry mode is obtained in database, and determines these Data Entries in redis databases
Key, obtain key lists.
(5)By storage associated with corresponding key lists the key of each index into redis databases, index is realized
With associating for Data Entry, so as to complete the issue of data.
Afterwards, it is possible to provide the api interface for data query to application server, inquire about the example of api interface such as
Under:
List<Promotion>list=Redis<Promotion>.Instance.GetData("
PriceOffPercent desc,LessPrice desc,DTime desc","SpecId,PID0").ToList();
Corresponding GetData methods are realized as follows:
After above-mentioned data-storage system on-line running, it is found that dealer makes a price reduction the tps of ranking list data-query interfaces
(Transactions Per Second, number of transactions/second)1023088 are brought up to from original 6714, performance obtains significantly
Lifting.
The data-storage system and date storage method of the embodiment of the present invention given below carry out piecemeal to data and index
The example of parallel computation.
Fig. 4 shows that the block parallel of data and index calculates schematic diagram in the embodiment of the present invention.Reference picture 4, data and
The block parallel calculating process of index is as follows:
(1)Data Entry for treating to be written to the second data storage from the first data storage, judges these data
Whether the quantity of entry is more than threshold value, if so, then the first data storage can be divided into multiple data fields(Such as i),
And start multiple first threads(Such as i), the corresponding data calculating subtask of each first thread, each data calculate sub
Task is responsible for obtaining each Data Entry from a data field of the first data storage, and acquired Data Entry is stored
Into the second data storage.If the quantity of Data Entry is not more than threshold value, the first data storage can not be carried out
Subregion, whole Data Entries is handled merely with a thread.Certainly, each first thread can also correspond to multiple data meters
Operator task.
(2)Start multiple second threads(For example, n), the corresponding ranking index calculating son times of each second thread
Business, each ranking index calculate subtask and are responsible for sorted lists(Such as there is n order by)In a sorting query mode,
Sorting data entry set corresponding be responsible for sorting query mode is determined from the first data storage.Certainly, each
Second thread can also correspond to multiple ranking index and calculate subtask.For example, there is 20 order by, then it can start 5
Two threads, each second thread process, 4 order by.
(3)Start multiple 3rd threads(For example, n*m), the corresponding sequence * packet index meters of each 3rd thread
Operator task(Assuming that there is m group by), each * packet indexes that sort, which calculate subtask, to be responsible for from corresponding sorting data bar
Determined and the index in mesh set(Determined by the combination of corresponding sequence and packet)Associated one or more data strips
Mesh.Certainly, each 3rd thread can also correspond to multiple sequence * packet indexes and calculate subtask.
(4)For each 3rd thread, the number of Data Entry in its corresponding sorting data entry set can also be judged
Whether amount is more than threshold value, if so, sorting data entry set can be then divided into multiple data blocks(For example, x), and open
Move multiple 4th threads(For example, x), it is associated with the index that each 4th thread is responsible for the determination from a data block
One or more Data Entries.If the quantity of Data Entry is not more than threshold value, sorting data entry set can not be entered
Row piecemeal, whole Data Entries is handled merely with a thread.Certainly, each 4th thread can also be responsible for multiple data
The processing of block.
According to above-mentioned parallel processing, data greatly improved and index write-in speed when being written to the second data storage
Degree.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein.
Various general-purpose systems can also be used together with teaching based on this.As described above, required by constructing this kind of system
Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that it can utilize various
Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the specification that this place provides, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect,
Above in the description to the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor
The application claims of shield features more more than the feature being expressly recited in each claim.It is more precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself
Separate embodiments all as the present invention.
Those skilled in the art, which are appreciated that, to be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment
Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any
Combination is to this specification(Including adjoint claim, summary and accompanying drawing)Disclosed in all features and so disclosed appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification(Including adjoint power
Profit requirement, summary and accompanying drawing)Disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation
Replace.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
One of meaning mode can use in any combination.
The all parts embodiment of the present invention can be realized with hardware, or to be run on one or more processor
Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that it can use in practice
Microprocessor or digital signal processor(DSP)Come realize in data-storage system according to embodiments of the present invention some or
The some or all functions of person's whole part.The present invention is also implemented as perform method as described herein one
Divide either whole equipment or program of device(For example, computer program and computer program product).It is such to realize this hair
Bright program can store on a computer-readable medium, or can have the form of one or more signal.It is such
Signal can be downloaded from internet website and obtained, and either provided on carrier signal or provided in the form of any other.
A1, a kind of date storage method, suitable for the Data Entry from the first data storage is stored to the second data
In memory, this method includes:Index list, rope are constructed according to the inquiry mode to the Data Entry in the first data storage
The each index drawn in list corresponds to a kind of inquiry mode;Each rope in the index list is stored in the second data storage
Draw, wherein each index includes the index name for identifying the index;First data storage is divided into multiple data fields, started
Multiple first threads, each first thread are responsible for obtaining each data from one or more data fields of the first data storage
Entry, acquired Data Entry is stored into the second data storage, wherein in the second data storage, each data
Entry includes the unique mark of Data Entry and associated data content;According to the inquiry mode corresponding with each index
It is determined that one or more associated Data Entry, and determine unique mark of each Data Entry in the second data storage
Know, obtain the Data Entry identification list associated with the index;And the Data Entry associated with each index is identified
List stores into the second data storage in association with the index name each indexed.A2, the data storage as described in A1
Method, wherein, the basis constructs index list to the inquiry mode of the Data Entry in the first data storage, including:Root
Sorted lists are established according to the sorting query mode to Data Entry, and packet is established according to the Querying by group mode to Data Entry
List;Cartesian product is carried out according to sorted lists and group list, constructs the index list.A3, the data as described in A2
Storage method, wherein, the basis inquiry mode corresponding with each index determines one or more associated data
Entry, and unique mark of each Data Entry in the second data storage is determined, obtain the data strip associated with the index
Mesh identification list, including:Start multiple second threads, each second thread is responsible for the sequence of one or more of sorted lists and looked into
Inquiry mode, sorting data entry set corresponding be responsible for sorting query mode is determined from the first data storage;Open
Move multiple 3rd threads, each 3rd thread be responsible for one or more of index list index, from be responsible for index pair
The one or more Data Entries associated with the index are determined in the sorting data entry set answered, and determine each Data Entry
Unique mark in the second data storage, obtain the Data Entry identification list associated with the index.A4, as described in A3
Date storage method, wherein, it is described from sorting data entry set corresponding be responsible for index determine with the index
Associated one or more Data Entries, including:Sorting data entry set is divided into multiple data blocks, starts multiple the
Four threads, each 4th thread are responsible for determining the one or more data associated with the index from one or more data blocks
Entry.A5, the date storage method as described in A2, A3 or A4, wherein, the index name identify including sorting query mode and
Querying by group mode identifies;In second data storage, the unique mark of each Data Entry exists for the Data Entry
Unique mark in first data storage, and data content are to be obtained after each field of Data Entry is serialized
Content.A6, the date storage method as described in A5, wherein, the index name also includes data key values type;Described
In two data storages, the unique mark of each Data Entry also includes data key values type, and data content is by data
The content that each field corresponding with data key values type of entry obtains after being serialized;Wherein, the data key values class
Type is used to identify key value information, and the key assignments is one or more field names of Data Entry.A7, the data as described in A5 are deposited
Method for storing, wherein, in addition to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key
Value, wherein the key assignments is one or more field names of Data Entry;Index name is determined according to inquiry mode, from second
The Data Entry identification list associated with index name is searched in data storage, and is identified according to the Data Entry found
List obtains associated data content from the second data storage;The data content got serialize, and
Content corresponding with key assignments is obtained in content after serializing is gone and returns to application server.A8, the data as described in A6 are deposited
Method for storing, wherein, in addition to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key
Value;Index name is determined according to inquiry mode and key assignments, the number associated with index name is searched from the second data storage
Associated number is obtained from the second data storage according to entry identification list, and according to the Data Entry identification list found
According to content;The data content got serialize, the content after serializing will be gone to return to application server.
A9, the date storage method as described in A1, wherein, the Data Entry in the first data storage is with relational data
Storehouse mode is stored;And the second index in data storage using index name as key, with associated data strip target
Know list to be stored for the key-value mode of value, and Data Entry using the unique mark of Data Entry as key, with what is be associated
Data content is stored for the key-value mode of value.B1, a kind of data-storage system, suitable for the first data storage will be come from
Data Entry store into the second data storage, the system includes:Index list structural unit, suitable for being counted according to first
According to the inquiry mode construction index list of the Data Entry in memory, each index in index list corresponds to a kind of issuer
Formula;Index storage unit, suitable for storing each index in the index list in the second data storage, wherein each index
Index name including identifying the index;Data Entry memory cell, suitable for the first data storage is divided into multiple data
Area, starts multiple first threads, and each first thread is responsible for obtaining from one or more data fields of the first data storage
Each Data Entry, acquired Data Entry is stored into the second data storage, wherein in the second data storage,
Each Data Entry includes the unique mark of Data Entry and associated data content;And associative cell, suitable for basis
The inquiry mode corresponding with each index determines one or more associated Data Entry, and determines that each Data Entry exists
Unique mark in second data storage, obtain the Data Entry identification list associated with the index;Wherein, the index
Memory cell is configured to the Data Entry identification list associated to each index is related with the index name each indexed
The storage of connection ground is into the second data storage.B2, the data-storage system as described in B1, wherein, the index list construction is single
Member is configured to:Sorted lists are established according to the sorting query mode to Data Entry, and looked into according to the packet to Data Entry
Inquiry mode establishes group list;Cartesian product is carried out according to sorted lists and group list, constructs the index list.B3、
Data-storage system as described in claim B2, wherein, the associative cell is configured to:Start multiple second threads, often
Individual second thread is responsible for one or more of sorted lists sorting query mode, determines and bears from the first data storage
Sorting data entry set corresponding to the sorting query mode of duty;Start multiple 3rd threads, each 3rd thread is responsible for index
One or more of list indexes, and is determined and the index phase from sorting data entry set corresponding be responsible for index
One or more Data Entries of association, and determine unique mark of each Data Entry in the second data storage, obtain with
The associated Data Entry identification list of the index.B4, the data-storage system as described in claim B3, wherein, the pass
Receipts or other documents in duplicate member is configured to:Sorting data entry set is divided into multiple data blocks, starts multiple 4th threads, each 4th line
Journey is responsible for determining the one or more Data Entries associated with the index from one or more data blocks.B5, such as right will
The data-storage system described in B2, B3 or B4 is sought, wherein, the index name is identified including sorting query mode and Querying by group
Mode identifies;In second data storage, the unique mark of each Data Entry is the Data Entry in the first data
Unique mark in memory, and data content are the content obtained after each field of Data Entry is serialized.
B6, the data-storage system as described in claim B5, wherein, the index name also includes data key values type;Described
In second data storage, the unique mark of each Data Entry also includes data key values type, and data content is by number
The content obtained after being serialized according to each field corresponding with data key values type of entry;Wherein, the data key values
Type is used to identify key value information, and the key assignments is one or more field names of Data Entry.B7, such as claim B5 institutes
The data-storage system stated, wherein, second data storage also includes query interface, and the query interface is configured to:
The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments, wherein the key assignments is number
According to one or more field names of entry;Index name is determined according to inquiry mode, from the second data storage search with
The associated Data Entry identification list of index name, and according to the Data Entry identification list found from the second data storage
Associated data content is obtained in device;The data content got serialize, and the content after serializing is gone
It is middle to obtain corresponding with key assignments content and return to application server.B8, the data-storage system as described in claim B6, its
In, second data storage also includes query interface, and the query interface is configured to:Obtain from application server
Inquiry request, the inquiry request include inquiry mode and key assignments;Index name is determined according to inquiry mode and key assignments, from second
The Data Entry identification list associated with index name is searched in data storage, and is identified according to the Data Entry found
List obtains associated data content from the second data storage;The data content got serialize, will
The content gone after serializing returns to application server.B9, the data-storage system as described in claim B1, wherein, first
Data Entry in data storage is stored in a manner of relevant database;And the second index in data storage with
Index name is key, stored in a manner of associated Data Entry identification list is the key-value of value, and Data Entry with
The unique mark of Data Entry is key, stored in a manner of associated data content is the key-value of value.C1, a kind of data
Inquiry system, including the first data storage, data distribution server and the second data storage, wherein, the data publication
Server includes the data-storage system as any one of B1 to B9.
Claims (15)
- A kind of 1. date storage method, suitable for the Data Entry from the first data storage is stored to the second data storage In, first data storage is relevant database, and second data storage is the no sql data of key-value formula Storehouse, it includes query interface, and the query interface is suitable to receive the inquiry request that application server is sent, acquisition and inquiry request Corresponding Data Entry simultaneously returns to application server, and this method includes:Index list is constructed according to the inquiry mode to the Data Entry in the first data storage:According to the row to Data Entry Sequence inquiry mode establishes sorted lists, and establishes group list according to the Querying by group mode to Data Entry;According to Sorted list Table and group list carry out cartesian product, construct the index list, the corresponding a kind of inquiry of each index in index list Mode;Each index in the index list is stored in the second data storage, wherein each index includes identifying the index Index name, index in the second data storage using index name as key, using associated Data Entry identification list as value Key-value mode stored;First data storage is divided into multiple data fields, starts multiple first threads, each first thread is responsible for from first Each Data Entry is obtained in one or more data fields of data storage, by acquired Data Entry storage to the second number According in memory, wherein in the second data storage, each Data Entry includes the unique mark and correlation of Data Entry The data content of connection, Data Entry using the unique mark of Data Entry as key, using associated data content as the key-value side that is worth Formula is stored;One or more associated Data Entry is determined according to the inquiry mode corresponding with each index, and determines each number According to unique mark of the entry in the second data storage, the Data Entry identification list associated with the index is obtained;AndThe Data Entry identification list associated with each index is stored with the index name each indexed in association to the In two data storages.
- 2. date storage method as claimed in claim 1, wherein, the basis inquiry mode corresponding with each index is true Surely one or more associated Data Entry, and unique mark of each Data Entry in the second data storage is determined, The Data Entry identification list associated with the index is obtained, including:Start multiple second threads, each second thread is responsible for one or more of sorted lists sorting query mode, from Sorting data entry set corresponding be responsible for sorting query mode is determined in one data storage;Start multiple 3rd threads, each 3rd thread is responsible for one or more of index list index, from it is be responsible for The one or more Data Entries associated with the index are determined in sorting data entry set corresponding to index, and determine each number According to unique mark of the entry in the second data storage, the Data Entry identification list associated with the index is obtained.
- 3. date storage method as claimed in claim 2, wherein, it is described from sorting data bar corresponding be responsible for index The one or more Data Entries associated with the index are determined in mesh set, including:Sorting data entry set is divided into multiple data blocks, starts multiple 4th threads, each 4th thread is responsible for from one The one or more Data Entries associated with the index are determined in individual or multiple data blocks.
- 4. such as the date storage method any one of claim 1-3, wherein, the index name includes sorting query side Formula identifies and Querying by group mode identifies;In second data storage, the unique mark of each Data Entry is the Data Entry in the first data storage In unique mark, and data content is obtained content after each field of Data Entry is serialized.
- 5. date storage method as claimed in claim 4, wherein, the index name also includes data key values type;In second data storage, the unique mark of each Data Entry also includes data key values type, and data Content is the content obtained after each field corresponding with data key values type of Data Entry is serialized;Wherein, the data key values type is used to identify key value information, and the key assignments is one or more fields of Data Entry Title.
- 6. date storage method as claimed in claim 4, wherein, in addition to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments, wherein the key assignments For one or more field names of Data Entry;Index name is determined according to inquiry mode, the Data Entry associated with index name is searched from the second data storage Identification list, and obtained according to the Data Entry identification list found from the second data storage in associated data Hold;The data content got serialize, and content corresponding with key assignments is obtained in the content after serializing is gone Return to application server.
- 7. date storage method as claimed in claim 5, wherein, in addition to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments;Index name is determined according to inquiry mode and key assignments, the number associated with index name is searched from the second data storage Associated number is obtained from the second data storage according to entry identification list, and according to the Data Entry identification list found According to content;The data content got serialize, the content after serializing will be gone to return to application server.
- A kind of 8. data-storage system, suitable for the Data Entry from the first data storage is stored to the second data storage In, first data storage is relevant database, and second data storage is the no sql data of key-value formula Storehouse, it includes query interface, and the query interface is suitable to receive the inquiry request that application server is sent, acquisition and inquiry request Corresponding Data Entry simultaneously returns to application server, and the system includes:Index list structural unit, suitable for constructing index column according to the inquiry mode to the Data Entry in the first data storage Table:Sorted lists are established according to the sorting query mode to Data Entry, and built according to the Querying by group mode to Data Entry Vertical group list;Cartesian product is carried out according to sorted lists and group list, constructs the index list, in index list A kind of each corresponding inquiry mode of index;Index storage unit, suitable for storing each index in the index list in the second data storage, wherein each rope Draw the index name including identifying the index, the index in the second data storage using index name as key, with associated number Stored according to entry identification list for the key-value mode of value;Data Entry memory cell, suitable for the first data storage is divided into multiple data fields, start multiple first threads, often Individual first thread is responsible for obtaining each Data Entry from one or more data fields of the first data storage, will be acquired Data Entry is stored into the second data storage, wherein in the second data storage, each Data Entry includes data strip Purpose unique mark and associated data content, Data Entry using the unique mark of Data Entry as key, with associated Data content is stored for the key-value mode of value;AndAssociative cell, suitable for determining one or more associated data strip according to the inquiry mode corresponding with each index Mesh, and unique mark of each Data Entry in the second data storage is determined, obtain the Data Entry associated with the index Identification list;Wherein, the index storage unit is configured to the Data Entry identification list associated with each index and each rope The index name drawn stores into the second data storage in association.
- 9. data-storage system as claimed in claim 8, wherein, the associative cell is configured to:Start multiple second threads, each second thread is responsible for one or more of sorted lists sorting query mode, from Sorting data entry set corresponding be responsible for sorting query mode is determined in one data storage;Start multiple 3rd threads, each 3rd thread is responsible for one or more of index list index, from it is be responsible for The one or more Data Entries associated with the index are determined in sorting data entry set corresponding to index, and determine each number According to unique mark of the entry in the second data storage, the Data Entry identification list associated with the index is obtained.
- 10. data-storage system as claimed in claim 9, wherein, the associative cell is configured to:Sorting data entry set is divided into multiple data blocks, starts multiple 4th threads, each 4th thread is responsible for from one The one or more Data Entries associated with the index are determined in individual or multiple data blocks.
- 11. such as the data-storage system any one of claim 8-10, wherein, the index name includes sorting query Mode identifies to be identified with Querying by group mode;In second data storage, the unique mark of each Data Entry is the Data Entry in the first data storage In unique mark, and data content is obtained content after each field of Data Entry is serialized.
- 12. data-storage system as claimed in claim 11, wherein, the index name also includes data key values type;In second data storage, the unique mark of each Data Entry also includes data key values type, and data Content is the content obtained after each field corresponding with data key values type of Data Entry is serialized;Wherein, the data key values type is used to identify key value information, and the key assignments is one or more fields of Data Entry Title.
- 13. data-storage system as claimed in claim 11, wherein, the query interface is configured to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments, wherein the key assignments For one or more field names of Data Entry;Index name is determined according to inquiry mode, the Data Entry associated with index name is searched from the second data storage Identification list, and obtained according to the Data Entry identification list found from the second data storage in associated data Hold;The data content got serialize, and content corresponding with key assignments is obtained in the content after serializing is gone Return to application server.
- 14. data-storage system as claimed in claim 12, wherein, the query interface is configured to:The inquiry request from application server is obtained, the inquiry request includes inquiry mode and key assignments;Index name is determined according to inquiry mode and key assignments, the number associated with index name is searched from the second data storage Associated number is obtained from the second data storage according to entry identification list, and according to the Data Entry identification list found According to content;The data content got serialize, the content after serializing will be gone to return to application server.
- 15. a kind of data query system, including the first data storage, data distribution server and the second data storage, its In, the data distribution server includes the data-storage system as any one of claim 8-14.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410126243.XA CN103902702B (en) | 2014-03-31 | 2014-03-31 | A kind of data-storage system and storage method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410126243.XA CN103902702B (en) | 2014-03-31 | 2014-03-31 | A kind of data-storage system and storage method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103902702A CN103902702A (en) | 2014-07-02 |
CN103902702B true CN103902702B (en) | 2017-11-28 |
Family
ID=50994024
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410126243.XA Active CN103902702B (en) | 2014-03-31 | 2014-03-31 | A kind of data-storage system and storage method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103902702B (en) |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105653528B (en) * | 2014-11-11 | 2020-04-07 | 金蝶软件(中国)有限公司 | Service field multi-state display method and device |
CN105069017A (en) * | 2015-07-13 | 2015-11-18 | 深圳市永兴元科技有限公司 | Report storage method in report system and report system |
US10108637B2 (en) * | 2016-03-08 | 2018-10-23 | International Business Machines Corporation | Spatial-temporal storage system, method, and recording medium |
CN107817946B (en) * | 2016-09-13 | 2021-06-04 | 阿里巴巴集团控股有限公司 | Method and device for reading and writing data of hybrid storage device |
CN106446201A (en) * | 2016-09-30 | 2017-02-22 | 福建中金在线信息科技有限公司 | Processing method and device of social circle data |
CN108268515B (en) * | 2016-12-30 | 2020-07-31 | 北京国双科技有限公司 | Selection method and device for dimension of aggregation table |
CN107656968B (en) * | 2017-08-31 | 2021-04-23 | 武汉斗鱼网络科技有限公司 | Method and system for exporting large-batch business data |
CN108536798B (en) * | 2018-04-02 | 2020-12-01 | 携程旅游网络技术(上海)有限公司 | Method and system for recovering database data of order level |
CN108776678B (en) * | 2018-05-29 | 2020-07-03 | 阿里巴巴集团控股有限公司 | Index creation method and device based on mobile terminal NoSQL database |
CN109145004A (en) * | 2018-08-29 | 2019-01-04 | 智慧互通科技有限公司 | A kind of method and device creating database index |
CN110149529B (en) * | 2018-11-01 | 2021-05-28 | 腾讯科技(深圳)有限公司 | Media information processing method, server and storage medium |
CN111143232B (en) * | 2018-11-02 | 2023-08-18 | 伊姆西Ip控股有限责任公司 | Method, apparatus and computer readable medium for storing metadata |
CN109828987A (en) * | 2019-01-21 | 2019-05-31 | 深圳乐信软件技术有限公司 | A kind of millions method for computing data, device, electronic equipment and medium |
CN113127659A (en) * | 2019-12-31 | 2021-07-16 | 深圳云天励飞技术有限公司 | Image data entry method and device, electronic equipment and storage medium |
CN111752947B (en) * | 2020-06-24 | 2023-08-18 | 中国银行股份有限公司 | Method and device for integrating system, storage medium and electronic equipment |
CN117519839B (en) * | 2024-01-05 | 2024-04-16 | 恒生电子股份有限公司 | Data loading method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102375853A (en) * | 2010-08-24 | 2012-03-14 | 中国移动通信集团公司 | Distributed database system, method for building index therein and query method |
CN102867070A (en) * | 2012-09-29 | 2013-01-09 | 瑞庭网络技术(上海)有限公司 | Method for updating cache of key-value distributed memory system |
CN103177027A (en) * | 2011-12-23 | 2013-06-26 | 北京新媒传信科技有限公司 | Method and system for obtaining dynamic feed index |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130093999A (en) * | 2012-02-15 | 2013-08-23 | 주식회사 시공미디어 | Travel information sharing service system using location based service interlinked no-sql and rdbms |
-
2014
- 2014-03-31 CN CN201410126243.XA patent/CN103902702B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102375853A (en) * | 2010-08-24 | 2012-03-14 | 中国移动通信集团公司 | Distributed database system, method for building index therein and query method |
CN103177027A (en) * | 2011-12-23 | 2013-06-26 | 北京新媒传信科技有限公司 | Method and system for obtaining dynamic feed index |
CN102867070A (en) * | 2012-09-29 | 2013-01-09 | 瑞庭网络技术(上海)有限公司 | Method for updating cache of key-value distributed memory system |
Non-Patent Citations (1)
Title |
---|
"Redis数据库在视频推荐服务系统中的应用";曹丹丹等;《计算机与现代化》;20131114(第10期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN103902702A (en) | 2014-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103902702B (en) | A kind of data-storage system and storage method | |
CN103902698B (en) | A kind of data-storage system and storage method | |
CN103902701B (en) | A kind of data-storage system and storage method | |
US11651036B2 (en) | Integrated index blocks and searching in blockchain systems | |
Wang et al. | Crowder: Crowdsourcing entity resolution | |
CN110292775B (en) | Method and device for acquiring difference data | |
CN103810224B (en) | information persistence and query method and device | |
CN109416694A (en) | The key assignments storage system effectively indexed including resource | |
CN104090962B (en) | Towards the nested query method of magnanimity distributed data base | |
CN107203424A (en) | A kind of method and apparatus that deep learning operation is dispatched in distributed type assemblies | |
EP2608074A2 (en) | Systems and methods for merging source records in accordance with survivorship rules | |
CN104765745B (en) | Loading data in database are carried out with the method and system of logic checking | |
CN106055621A (en) | Log retrieval method and device | |
CN106295250A (en) | Method and device is analyzed in the quick comparison of the short sequence of secondary order-checking | |
CN105426375B (en) | A kind of calculation method and device of relational network | |
CN108897761A (en) | A kind of clustering storage method and device | |
CN105608113B (en) | Judge the method and device of POI data in text | |
CN104281664B (en) | Distributed figure computing system data segmentation method and system | |
CN108776678B (en) | Index creation method and device based on mobile terminal NoSQL database | |
CN106294418B (en) | Search method and searching system | |
CN104794130B (en) | Relation query method and device between a kind of table | |
CN102169491A (en) | Dynamic detection method for multi-data concentrated and repeated records | |
CN104102694B (en) | Tree node sort method and tree node collator | |
CN106503186A (en) | A kind of data managing method, client and system | |
CN104794129B (en) | A kind of data processing method and system based on inquiry log |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C53 | Correction of patent for invention or patent application | ||
CB02 | Change of applicant information |
Address after: 100080 Beijing city Haidian District Danleng Street No. 3 floor 11 block B room 1109 Applicant after: BEIJING PIERRE BLANEY SOFTWARE CO., LTD. Address before: 100080 Beijing city Haidian District Danleng Street No. 3 floor 11 block B room 1109 Applicant before: BEIJING CHESHANGHUI SOFTWARE CO., LTD. |
|
COR | Change of bibliographic data |
Free format text: CORRECT: APPLICANT; FROM: BEIJING CHESHANGHUI SOFTWARE CO., LTD. TO: BEIJING PIER BULAINI SOFTWARE CO., LTD. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |