The content of the invention
It is existing to solve it is a primary object of the present invention to provide a kind of compression processing method and device of character string type row
There are the row in technology for character string type to compress the problem for the treatment of effeciency is low.
To achieve these goals, according to an aspect of the invention, there is provided at a kind of compression of character string type row
Reason method.
Included according to the compression processing method that the character string type of the present invention arranges:Determine processing data table to be compressed;It is determined that
Character tandem in processing data table to be compressed, wherein, character string is classified as in processing data table to be compressed as character string type
Row;Key assignments corresponding to string value in character tandem is determined, wherein, key assignments is the value of data type;By character in character tandem
String value replaces with key assignments corresponding with string value in character tandem;The first storage index is obtained, wherein, the first storage index is
The corresponding index created according to key assignments corresponding to string value in character tandem;And according to the first storage index to be compressed
Processing data table is compressed processing.
Further, by string value in character tandem replace with key assignments corresponding with string value in character tandem it
Afterwards, and before the first storage index is obtained, this method also includes:Replaced with and character by string value in character tandem
In tandem after key assignments corresponding to string value, the key assignments after replacing is obtained;And according to the number of key assignments generation first after replacement
According to table, wherein, the first tables of data is to be stored with the key assignments after replacing and processing data table to be compressed to remove outside character tandem
Tables of data.
Further, it is determined that in character tandem after key assignments corresponding to string value, and by word in character tandem
Before symbol string value replaces with key assignments corresponding with string value in character tandem, this method also includes:The second tables of data is created, its
In, the second tables of data is used for the data for storing key assignments corresponding to string value in string value and character tandem in character tandem
Table, after processing is compressed to character tandem according to the first storage index, this method also includes:The first view is created, its
In, the first view is the view of the first tables of data of connection and the second tables of data;And according to the first view display data information.
Further, after according to the first view display data information, this method also includes:Obtain data to be checked;Connect
Query statement is received, wherein, query statement is the instruction for indicating inquiry;And treated according to query statement in the first view
Inquire about data and perform inquiry operation.
Further, obtaining the first storage index includes:Determine the second storage rope corresponding to string value in character tandem
Draw;The index according to corresponding to creating key assignments corresponding to string value in character tandem;And according to string value in character tandem
Index corresponding to corresponding key assignments replaces the second storage index, obtains the first storage index.
To achieve these goals, according to another aspect of the present invention, there is provided at a kind of compression of character string type row
Manage device.
Included according to the compression treatment device that the character string type of the present invention arranges:First determining unit, for determining to wait to press
Contracting processing data table;Second determining unit, for determining the character tandem in processing data table to be compressed, wherein, character tandem
To be the row of character string type in processing data table to be compressed;3rd determining unit, for determining string value in character tandem
Corresponding key assignments, wherein, key assignments is the value of data type;Replacement unit, for by string value in character tandem replace with
Key assignments corresponding to string value in character tandem;First acquisition unit, for obtaining the first storage index, wherein, the first storage
Index the corresponding index created for the key assignments according to corresponding to string value in character tandem;And compression processing unit, it is used for
Processing is compressed to processing data table to be compressed according to the first storage index.
Further, the device also includes:Second acquisition unit, for by string value in character tandem replace with
In character tandem after key assignments corresponding to string value, the key assignments after replacing is obtained;And generation unit, after according to replacement
Key assignments generate the first tables of data, wherein, the first tables of data be stored with replace after key assignments and processing data table to be compressed in
Remove the tables of data outside character tandem.
Further, the device also includes:First creating unit, for creating the second tables of data, wherein, the second tables of data
For storing the tables of data of key assignments corresponding to string value in string value and character tandem in character tandem, second create it is single
Member, for creating the first view, wherein, the first view is the view of the first tables of data of connection and the second tables of data;And display
Unit, for according to the first view display data information.
Further, the device also includes:3rd acquiring unit, for obtaining data to be checked;Receiving unit, for connecing
Query statement is received, wherein, query statement is the instruction for indicating inquiry;And query unit, for being existed according to query statement
Inquiry operation is performed to data to be checked in first view.
Further, first acquisition unit includes:Determining module, for determining in character tandem corresponding to string value
Two storage indexes;Creation module, for index corresponding to the key assignments establishment according to corresponding to string value in character tandem;And replace
Block is changed the mold, the second storage index is replaced for index corresponding to the key assignments according to corresponding to string value in character tandem, obtains the
One storage index.
By the present invention, using following steps:Determine processing data table to be compressed;Determine in processing data table to be compressed
Character tandem, wherein, character string is classified as in processing data table to be compressed as the row of character string type;Determine character in character tandem
Key assignments corresponding to string value, wherein, key assignments is the value of data type;By string value in character tandem replace with character tandem
Key assignments corresponding to string value;The first storage index is obtained, wherein, the first storage index is according to string value in character tandem
The corresponding index that corresponding key assignments creates;And place is compressed to processing data table to be compressed according to the first storage index
Reason, solve the problems, such as that to compress treatment effeciency low for the row of character string type in the prior art, and then lifting is to word
Accord with the effect of the compression treatment effeciency of the row of string type.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase
Mutually combination.Describe the present invention in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
In order that those skilled in the art more fully understand application scheme, below in conjunction with the embodiment of the present application
Accompanying drawing, the technical scheme in the embodiment of the present application is clearly and completely described, it is clear that described embodiment is only
The embodiment of the application part, rather than whole embodiments.Based on the embodiment in the application, ordinary skill people
The every other embodiment that member is obtained under the premise of creative work is not made, it should all belong to the model of the application protection
Enclose.
It should be noted that term " first " in the description and claims of this application and above-mentioned accompanying drawing, "
Two " etc. be for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that so use
Data can exchange in the appropriate case, so as to embodiments herein described herein.In addition, term " comprising " and " tool
Have " and their any deformation, it is intended that cover it is non-exclusive include, for example, containing series of steps or unit
Process, method, system, product or equipment are not necessarily limited to those steps clearly listed or unit, but may include without clear
It is listing to Chu or for the intrinsic other steps of these processes, method, product or equipment or unit.
According to an embodiment of the invention, there is provided a kind of compression processing method of character string type row.
Fig. 1 is the flow chart of the compression processing method of character string type row according to a first embodiment of the present invention.Such as Fig. 1 institutes
Show, this method includes steps S101 to step S106:
Step S101, determine processing data table to be compressed.
It is determined that need to perform the tables of data of compression processing.It is determined that the tables of data of needs execution compression processing has many sides
Formula, for example, according to the selection instruction of external data, select to need to perform at compression in multiple tables of data according to the selection instruction
Tables of data of reason etc..
Step S102, determine the character tandem in processing data table to be compressed.
The character tandem in processing data table to be compressed is determined, wherein, character string, which is classified as in processing data table to be compressed, is
The row of character string type.
Herein, the row for determining the character string type in processing data table to be compressed are to find out the row that type is character string,
For example, in database, processing data table to be compressed is StudentScore tables, contains student's surname in the StudentScore tables
Tri- row of name Name, student performance Score and student address Address, wherein, Name and Address are character string type
Row.
Step S103, determine key assignments corresponding to string value in character tandem.
Key assignments corresponding to string value in character tandem is determined, wherein, key assignments is the value of data type.
For example, confirm that processing data table to be compressed is key assignments corresponding to character tandem Address in StudentScore,
Such as, AddressKey self-propagations arrange.
Step S104, string value in character tandem is replaced with into key assignments corresponding with string value in character tandem.
String value in character tandem is replaced with into key assignments corresponding with string value in character tandem.
For example, processing data table to be compressed is to include field AddressKey and Address in StudentScore.According to
Update-Select sentences in SQL, it is that Address is replaced with StudentScore by processing data table to be compressed
AddressKey.A kind of mode of the specific implementation step is as follows:
UPDATE StudentScore SET AddressKey=a.AddressKey FROM StudentAddress
A, StudentScore b WHERE a.Address=b.Address are matched in Address fields,
AddressKey in StudentAddress substitutes the Address in StudentScore.So after this step, it is to be compressed
What is included in processing data table StudentScore is classified as Name, Score and AddressKey.
By the step, string value in character tandem is replaced with into key assignments corresponding with string value in character tandem.
In to processing data table to be compressed character tandem perform compression processing when, be converted into in processing data table to be compressed with character
The key assignments of value type corresponding to string value performs compression processing in tandem.The word in improving to processing data table to be compressed
Symbol tandem is compressed the efficiency of processing.
Preferably, the compression processing method of character string type provided in an embodiment of the present invention row, by word in character tandem
, should after symbol string value replaces with key assignments corresponding with string value in character tandem, and before the first storage index is obtained
Method also includes:After string value in character tandem is replaced with into key assignments corresponding with string value in character tandem, obtain
Take the key assignments after replacing;And the first tables of data is generated according to the key assignments after replacement, wherein, the first tables of data is to be stored with replacement
The tables of data outside character tandem is removed in key assignments and processing data table to be compressed afterwards.
Specifically, can be according to the insertion sentence Insert-Select in database, qualified field insertion the
One tables of data, for example, a kind of specific implementation that qualified field is inserted to the first tables of data is:Insert into
StudentAddress(Address)Select Address From StudentScore。
Step S105, obtain the first storage index.
The first storage index is obtained, wherein, the first storage index is the key assignments according to corresponding to string value in character tandem
The corresponding index created.
For example, obtain the key-value pair of value type corresponding with string value in character tandem in processing data table to be compressed
The index answered, the AddressKe y keys corresponding to character tandem Address in processing data table to be compressed is StudentScore
Value row.AddressKey utilizes the Create Index sentences provided in SQL to establish index Index_AddressK ey.By rope
Draw Index_AddressKey as the first storage index, obtain the first storage index, that is, index Index_AddressKey.
By the step, get in character tandem and indexed corresponding to key assignments corresponding to string value, instead of character string
Corresponding index in row, therefore when being compressed processing to processing data table to be compressed according to index, improve to be compressed
Character tandem is compressed the efficiency of processing in processing data table.
Step S106, processing is compressed to processing data table to be compressed according to the first storage index.
Processing is compressed to processing data table to be compressed according to the first storage index.
For example, according to the first of above-mentioned acquisition storage index for Index_AddressKey to processing data table St to be compressed
UdentScore is compressed processing.
Because the first storage index is compressed processing to processing data table to be compressed, the first storage index is according to number
It is worth the index that the key assignments of class creates, instead of corresponding index in character tandem, place is compressed to processing data table to be compressed
During reason, by making character tandem standardize, using key assignments corresponding to character tandem, i.e. the less value type of space-consuming replaces
Change, save space, improve the compression efficiency of row storage.The index created according to the key assignments of value type performs the effect of compression processing
Rate performs the efficiency of compression processing apparently higher than according to corresponding index in character tandem, therefore improves to processing number to be compressed
The efficiency of processing is compressed according to character tandem in table, reduces the occupancy in space.
Preferably, in order to realize to the transparent of external system, the compression of character string type row provided in an embodiment of the present invention
Processing method, after being compressed processing to processing data table to be compressed according to the first storage index, this method also includes:Create
Second tables of data, wherein, the second tables of data is used to store in character tandem that string value to be corresponding in string value and character tandem
Key assignments tables of data, create the first view, wherein, the first view for connection the first tables of data and the second tables of data view;
And according to the first view display data information.
For example, using the external system of StudentScore tables, StudentScore views are created, are linked in view
StudentScore and StudentAddress tables, still provide student name Name, student performance Score and student address
Tri- row of Address, are realized to the transparent of external system.
Preferably, in order to improve search efficiency, the compression processing method of character string type row provided in an embodiment of the present invention,
After the first view display data information, this method also includes:Obtain data to be checked;Query statement is received, wherein, look into
It is the instruction for indicating inquiry to ask instruction;And inquiry behaviour is performed in the first view to data to be checked according to query statement
Make.
Data to be checked are inquired about in the first view by the program, it is corresponding with character tandem according to character tandem
Key assignments between mapping relations, return to Query Result in time, improve search efficiency.
The compression processing method of character string type row provided in an embodiment of the present invention, by determining processing data to be compressed
Table;The character tandem in processing data table to be compressed is determined, wherein, it is character string that character string, which is classified as in processing data table to be compressed,
The row of type;Key assignments corresponding to string value in character tandem is determined, wherein, key assignments is the value of data type;By character tandem
Middle string value replaces with key assignments corresponding with string value in character tandem;The first storage index is obtained, wherein, the first storage
Index the corresponding index created for the key assignments according to corresponding to string value in character tandem;And according to the first storage index pair
Processing data table to be compressed is compressed processing, solves in the prior art for the row of character string type, compresses treatment effeciency
The problem of low, and then the effect of compression treatment effeciency of the lifting to the row of character string type.
Fig. 2 is the flow chart of the compression processing method of character string type row according to a second embodiment of the present invention.Fig. 2 can be with
A kind of preferred embodiment as embodiment illustrated in fig. 1.As shown in Fig. 2 this method includes steps S201 to step
S208:
Step S201, determine processing data table to be compressed.
The step is with above-mentioned steps S101, and therefore not to repeat here.
Step S202, the character tandem in processing data table to be compressed is determined, wherein, character string is classified as processing number to be compressed
According to the row in table being character string type.
The step is with above-mentioned steps S102, and therefore not to repeat here.
Step 203, key assignments corresponding to string value in character tandem is determined, wherein, key assignments is the value of data type.
The step is with above-mentioned steps S103, and therefore not to repeat here.
Step S204, string value in character tandem is replaced with into key assignments corresponding with string value in character tandem.
The step is with above-mentioned steps S104, and therefore not to repeat here.
Step S205, determine the second storage index corresponding to string value in character tandem.
The second storage index corresponding to string value in character tandem is determined, specifically, it is determined that character string in character tandem
The second storage index has many modes corresponding to value.
For example, in database, processing data table to be compressed is StudentScore tables, is contained in the StudentScore tables
There are tri- row of student name Name, student performance Score and student address Address, wherein, Name and Address are character
The row of string type.Row storage index Index_ is created on Address and Name by Create Index sentences in SQL
Address and Index_Name.Storage index corresponding to determining on Address and Name for Index_Address and
Index_Name。
Step S206, the index according to corresponding to creating key assignments corresponding to string value in character tandem.
The index according to corresponding to creating key assignments corresponding to string value in character tandem.
For example, in database, processing data table to be compressed is StudentScore tables, is contained in the StudentScore tables
There are tri- row of student name Name, student performance Score and student address Address, wherein, Name and Address are character
The row of string type.AddressKey corresponding to Address character tandems is determined, according to the Create Index provided in SQL
Sentence establishes index Index_AddressKey.
Step S207, the index according to corresponding to key assignments corresponding to string value in character tandem replace the second storage index,
Obtain the first storage index.
For example, the Index_ that the key assignments AddressKey according to corresponding to string value in character tandem Address is created
AddressKey indexes substitute string value in character tandem Address and correspond to Index_Address indexes.
By the step, index corresponding to key assignments corresponding to string value in character tandem is replaced into the second storage and indexed,
The first storage index is obtained, makes full use of complimentary nature of the numerical value for row storage index in compression.
Step S208, processing is compressed to processing data table to be compressed according to the first storage index.
The step is with above-mentioned steps S106, and therefore not to repeat here.
The compression processing method of character string type row provided in an embodiment of the present invention, by determining processing data to be compressed
Table;The character tandem in processing data table to be compressed is determined, wherein, it is character string that character string, which is classified as in processing data table to be compressed,
The row of type;Key assignments corresponding to string value in character tandem is determined, wherein, key assignments is the value of data type;By character tandem
Middle string value replaces with key assignments corresponding with string value in character tandem;Determine in character tandem corresponding to string value
Two storage indexes;The index according to corresponding to creating key assignments corresponding to string value in character tandem;According to character in character tandem
Index corresponding to key assignments corresponding to string value replaces the second storage index, obtains the first storage index;And according to the first storage rope
Draw and processing is compressed to processing data table to be compressed, solve in the prior art for the row of character string type, compression processing
The problem of efficiency is low, and then the effect of compression treatment effeciency of the lifting to the row of character string type.
It should be noted that can be in such as one group of computer executable instructions the flow of accompanying drawing illustrates the step of
Performed in computer system, although also, show logical order in flow charts, in some cases, can be with not
The order being same as herein performs shown or described step.
The embodiment of the present invention additionally provides a kind of compression treatment device of character string type row, it is necessary to explanation, this hair
Bright embodiment character string type row compression treatment device can be used for perform the embodiment of the present invention provided be used for character
The compression processing method of string type row.The compression treatment device of character string type provided in an embodiment of the present invention row is carried out below
Introduce.
Fig. 3 is the schematic diagram of the compression treatment device of character string type row according to embodiments of the present invention.As shown in figure 3,
The device includes:First determining unit 10, the second determining unit 20, the 3rd determining unit 30, replacement unit 40, first obtain single
Member 50 and compression processing unit 60.
First determining unit 10, for determining processing data table to be compressed.
Second determining unit 20, for determining the character tandem in processing data table to be compressed, wherein, character string, which is classified as, to be treated
Compress in processing data table for the row of character string type.
3rd determining unit 30, for determining key assignments corresponding to string value in character tandem, wherein, key assignments is data class
The value of type.
Replacement unit 40, for string value in character tandem to be replaced with into key corresponding with string value in character tandem
Value.
First acquisition unit 50, for obtaining the first storage index, wherein, the first storage index is according in character tandem
The corresponding index that key assignments corresponding to string value creates.
Preferably, the first acquisition unit also includes:Determining module, for determining in character tandem corresponding to string value
Second storage index;Creation module, for index corresponding to the key assignments establishment according to corresponding to string value in character tandem;And
Replacement module, the second storage index is replaced for index corresponding to the key assignments according to corresponding to string value in character tandem, is obtained
First storage index.
Compression processing unit 60, for being compressed processing to processing data table to be compressed according to the first storage index.
Preferably, in the compression treatment device of character string type provided in an embodiment of the present invention row, the device also includes:
Second acquisition unit, for by string value in character tandem replace with key assignments corresponding with string value in character tandem it
Afterwards, the key assignments after replacing is obtained;And generation unit, for generating the first tables of data according to the key assignments after replacement, wherein, first
Tables of data is to be stored with the tables of data removed in the key assignments after replacing and processing data table to be compressed outside character tandem.
Preferably, in order to realize to the transparent of external system, in the pressure of character string type provided in an embodiment of the present invention row
In contracting processing unit, the device also includes:First creating unit, for creating the second tables of data, wherein, the second tables of data is used for
The tables of data of key assignments corresponding to string value in string value and character tandem in character tandem is stored, the second creating unit, is used
In creating the first view, wherein, the first view for the first tables of data of connection and the second tables of data view;And display unit,
For according to the first view display data information.
Preferably, in order to improve search efficiency, dress is handled in the compression of character string type provided in an embodiment of the present invention row
In putting, the device also includes:3rd acquiring unit, for obtaining data to be checked;Receiving unit, for receiving query statement,
Wherein, query statement is the instruction for indicating inquiry;And query unit, for according to query statement in the first view it is right
Data to be checked perform inquiry operation.
The compression treatment device of character string type row provided in an embodiment of the present invention, determine to treat by the first determining unit 10
Compress processing data table;Second determining unit 20 determines the character tandem in processing data table to be compressed, wherein, character string is classified as
It is the row of character string type in processing data table to be compressed;3rd determining unit 30 is determined in character tandem corresponding to string value
Key assignments, wherein, key assignments is the value of data type;Replacement unit 40 by string value in character tandem replace with character tandem
Key assignments corresponding to string value;First acquisition unit 50 obtains the first storage index, wherein, the first storage index is according to character
The corresponding index that key assignments corresponding to string value creates in tandem;Compression processing unit 60 treats pressure according to the first storage index
Contracting processing data table is compressed processing, solves low for the row of character string type, compression treatment effeciency in the prior art
Problem, and then the effect of compression treatment effeciency of the lifting to the row of character string type.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also
That unit is individually physically present, can also two or more units it is integrated in a unit.Above-mentioned integrated list
Member can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general
Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and formed
Network on, alternatively, they can be realized with the program code that computing device can perform, it is thus possible to they are stored
Performed in the storage device by computing device, either they are fabricated to respectively each integrated circuit modules or by they
In multiple modules or step be fabricated to single integrated circuit module to realize.So, the present invention is not restricted to any specific
Hardware and software combines.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.