The database storing method that a kind of ranks mix
Technical field
The present invention relates to a kind of data database storing technology, the ranks that relate in particular to a kind of application oriented storage magnanimity unstructured data object mix storage means.
Background technology
At present, the data of data base management system (DBMS) management appear with the bivariate table form of row, row, row corresponding record, row corresponding the field of record.
Traditional line data storehouse, is written to the data value of delegation in internal memory or the hard disk as an one dimension character string during data in storage, therefore if inquire about certain field value of certain bar record, then need read the whole piece record.But for the inquiry intensive applications, a part of field value of record is often only used in the great majority inquiry.Adopt the row memory technology, can cause system on the reading and store of data, to have following weak point, on performance, can't satisfy demands of applications.
At first, though only use a part of field of record, the existing capable memory technology system that makes must all read the whole piece record in the buffer memory; So not only cause data reading speed to reduce; The I/O expense is excessive, and loads unwanted field and also wasted valuable spatial cache, reduces cache hit rate; Make the follow-up data processing delay, the performance of system is affected.
Secondly, the field of record can be divided into inquiry field commonly used and non-common field, if non-common field is placed on the cheap apparatus, can reduce carrying cost.But existing capable memory technology characteristics have determined that the field commonly used and the field that is of little use are to store continuously, have taken same storage resources on disk.This is unfavorable for the reasonable distribution of resource apparatus.
Row formula database appear at the above deficiency that has remedied the line data storehouse to a certain extent.Its feature is that record is stored by row.But this also causes it when inquiry is used, to exist some problems.For example, if the inquiry demands of applications is to inquire about calculating according to the value of a certain row, obtain the degree of correlation the highest before some record numbers, and return the value of some specify columns (field) of these some records.Row formula database is when this demand of realization; Because record is by the row storage; So according to after the inquiry of the value of certain row and obtaining the relative recording numbering, the value of other specify columns that can not obtain immediately writing down, but also need search these specify columns earlier; And then from these specify columns, search record, read out the respective value of record.This search procedure has reduced the performance of inquiry.
Summary of the invention
For solving above-mentioned middle problem and the defective that exists, the invention provides a kind of database storing method of ranks mixing of application oriented storage magnanimity unstructured data object.Said technical scheme is following:
The database storing method that a kind of ranks mix comprises:
Create table and table corresponding physical memory space, establish the corresponding relation of row and amount of physical memory based on application demand;
In table, insert record, and divide into groups by the corresponding relation of row and amount of physical memory;
The train value of record is written in the corresponding physical storage space as row.
The beneficial effect of technical scheme provided by the invention is:
Mix storage means through ranks provided by the invention and avoided full table inquiry effectively, reduced the I/O expense, improved the speed that data read and the query performance of full-text database.
Description of drawings
Fig. 1 is the database storing method flow diagram that ranks mix;
Fig. 2 is the storage architecture design drawing of table.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, embodiment of the present invention is done to describe in detail further below in conjunction with accompanying drawing:
The database storing method that present embodiment provides a kind of ranks to mix, wherein,
Referring to Fig. 1, this method may further comprise the steps:
Step 10 is created table and table corresponding physical storage space, establishes the corresponding relation of row and storage space according to application demand;
Step 20 is inserted record in table, and divides into groups by the corresponding relation of row and amount of physical memory;
Step 30 is written to the train value of record in the corresponding physical storage space as row.
Above-mentioned steps 10 establishment tables comprise the required amount of physical memory of title, field and allocation table of establishment table, establish the corresponding relation of row and amount of physical memory, and above-mentioned row are field.In the present embodiment, each shows all corresponding one or more amount of physical memory (as shown in Figure 2), if do not do special appointment during the establishment table, system will distribute the amount of physical memory of an acquiescence automatically.After creating table, also can assess requisite space according to the dynamic change of data, new storage space is created in application.For the field in the table, when the establishment table, can specify it to be stored in which amount of physical memory, row (field) that like this can frequency of utilization is higher are stored in same storage space continuously, to improve the efficient that data read.
In the above-mentioned steps 20, when in table, inserting record,, and will write down by row (field) cutting for a unique identification number in this table created in record; According to the mapping table of field and amount of physical memory, train value (field value) is divided into groups, the train value (field value) of the row of corresponding same amount of physical memory is divided into same group, and each group can be regarded as a row vector.
Above-mentioned steps 30 as a row vector (an one dimension character string), is written to the corresponding physical storage space with the train value group after dividing into groups through the train value (field value) with record.Owing to store in order by record identify number during the data in the amount of physical memory, therefore insert the particular location of row vector and also confirm according to the size of record identify number.If should the correspondence amount of physical memory full, can't carry out insertion, then application is opened up a new amount of physical memory storing, and the mapping table of newer field and storage space more.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.