WO2015117280A1 - 一种数据处理和写入方法及相关装置 - Google Patents

一种数据处理和写入方法及相关装置 Download PDF

Info

Publication number
WO2015117280A1
WO2015117280A1 PCT/CN2014/071931 CN2014071931W WO2015117280A1 WO 2015117280 A1 WO2015117280 A1 WO 2015117280A1 CN 2014071931 W CN2014071931 W CN 2014071931W WO 2015117280 A1 WO2015117280 A1 WO 2015117280A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
column
segment
stored
disk
Prior art date
Application number
PCT/CN2014/071931
Other languages
English (en)
French (fr)
Inventor
夏静霆
柯亮
黄坚坚
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP14881915.4A priority Critical patent/EP3093772B1/en
Priority to PCT/CN2014/071931 priority patent/WO2015117280A1/zh
Priority to CN201480001004.XA priority patent/CN105408893B/zh
Publication of WO2015117280A1 publication Critical patent/WO2015117280A1/zh
Priority to US15/231,914 priority patent/US9710504B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/221Column-oriented storage; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2372Updates performed during offline database operations

Definitions

  • the present invention relates to the field of computers, and in particular, to a data processing method, a data writing method, and related devices. Background technique
  • a column storage database is a database with a fast query speed. It is separately stored by dividing a table relation in a relational database into a plurality of column columns, so that the database can read an entire column of data at a time during the query; Is to reduce the consumption of database projection operations: In the query, do not need to read the entire relation data, only need to read the corresponding column, greatly reducing the number of reads 10; but the storage method of the column database causes the column database to write Slower than the traditional line database; the existing column storage technology is to separate the columns of the relational database and store them separately. Then, when writing the rows, all the columns need to be modified at the same time. However, because the columns are split and stored, The row write to the hard disk requires multiple addressing, and the write efficiency is equivalent to random write. The random write speed is much slower than continuous write, which makes the column storage database write efficiency very low. Summary of the invention
  • the technical problem to be solved by the embodiments of the present invention is to provide a data processing method, a data writing method, and a related device, which solves the technical problem that the column database is slow in writing speed in the prior art, and greatly improves the column storage database. Write efficiency.
  • an embodiment of the present invention provides a data processing method, including:
  • the dividing and/or combining the data to be stored according to the allocated space of the disk cylinder comprises: Determining a continuous space of the disk cylinder to be allocated according to the set storage column width and the column attribute of the data to be stored;
  • All columns of the data to be stored are split and/or merged according to the storage column width, converted into at least one standard column, and conversion information is recorded; the column width of the standard column is the storage column width; The contiguous space of the allocated disk cylinders and the set segment storage size, each standard column after conversion is divided into at least one segment, and the size of each segment is divided into the segment storage of the set size.
  • the determining, according to the set storage column width and the column attribute of the data to be stored, determining the disk cylinder to be allocated Continuous space includes:
  • the storing the same row of data of the data to be stored Continuous storage of data in each column segment in the same disk cylinder and in the disk cylinder includes:
  • one segment of each standard column is sequentially stored in the allocated disk cylinder, and the data in each segment is continuously stored in order; wherein, the same The number of data rows for all segmentation data in the disk cylinder is the same.
  • Storing the same row of data of the data to be stored in the same disk cylinder, and continuously storing data in each column segment in the disk cylinder includes:
  • Each disc on the same physical cylinder surface starts at the starting position, and simultaneously stores the converted segments of each standard column, and the data in each segment is continuously stored in order; , all points The number of data lines of the segment data is the same.
  • storing one segment of each standard column in the allocated disk cylinder in turn includes:
  • each standard column is sequentially stored in the allocated disk cylinder, and then the next segment of each standard column is sequentially stored in the allocation.
  • the disk is in the cylinder.
  • the disk cylinder is at least one continuous logic Cylinder
  • the disk cylinder is a physical cylinder formed by the at least two disks.
  • the method further includes: generating a standard column management table, configured to store the set storage column width information, each standard The segmentation information corresponding to the column and the starting location information of each segment.
  • the method further includes:
  • the acquiring the segmentation start information and the conversion information corresponding to the data to be read includes:
  • an embodiment of the present invention provides a data writing method, including:
  • the determining, by the line number, the segment location to which the to-be-written row data belongs in the stored data includes:
  • the start information corresponding to the found segment is obtained from the standard column management table.
  • the searching for the segment to which the row data to be written belongs in the stored data according to the line number Locations include:
  • the start position of the segment to which the line data to be written belongs belongs in the stored data is found.
  • an embodiment of the present invention provides a data processing apparatus, including:
  • the data is obtained, and is used to obtain data to be stored in the data table in the column storage database; and the storage storage module is configured to divide and/or combine the data to be stored according to the allocated space of the disk cylinder;
  • the same row of data of the data to be stored is stored in the same disk cylinder, and the data in each column segment is continuously stored in the disk cylinder.
  • the editing storage module includes: a space determining unit, configured to determine, according to a set storage column width and a column attribute of the data to be stored, a disk to be allocated Continuous space of the cylinder; a conversion unit, configured to split and/or merge all the columns of the data to be stored according to the storage column width, convert into at least one standard column, and record conversion information; the column width of the standard column is Storage column width;
  • a segmentation unit configured to divide each converted standard column into at least one segment according to the contiguous space of the allocated disk cylinder and the set segment storage size, and the size of each segment is The set segmentation storage size.
  • the space determining unit includes:
  • a first calculating unit configured to calculate a quantity of a standard column according to a set storage column width and a column attribute of the data to be stored
  • the first determining unit is configured to determine a continuous space of the disk cylinder to be allocated according to the calculated number of required standard columns and the set segment storage size.
  • the editing storage module further includes:
  • a first segment storage unit configured to sequentially store one segment of each standard column in the allocated disk cylinder according to the column order of each standard column after conversion, and the data in each segment Continuously stored in order; where all segment data in the same disk cylinder has the same number of data rows.
  • the editing storage module when the data processing apparatus includes at least two disks, the editing storage module further includes:
  • a hardware calibration unit for calibrating a starting position of different disks constituting the same physical cylinder by hardware, wherein a starting position on each disk is aligned on the same physical cylinder surface;
  • a second segment storage unit configured to start each of the disks on the same physical cylinder surface at the starting position, and simultaneously store the converted segments of each standard column, and each segment The data in is continuously stored in order; wherein, all segment data has the same number of data rows.
  • the first segment storage unit when each standard column is divided into at least two segments, is specifically configured to:
  • each standard column is sequentially stored in the allocated disk cylinder, and then the next segment of each standard column is sequentially stored in the allocation.
  • the data in each segment is continuously stored in order; where all segment data in the same disk cylinder has the same number of data rows.
  • the disk cylinder is at least one continuous Logical cylinder
  • the disk cylinder is a physical cylinder formed by the at least two disks.
  • the data processing apparatus further includes:
  • the standard column management table generating module is configured to generate a standard column management table for storing the set storage column width information, the segmentation information corresponding to each standard column, and the starting position information of each segment.
  • the data processing device further includes:
  • a start information obtaining module configured to acquire segment start information and conversion information corresponding to the data to be read
  • a data reading module configured to read corresponding data by using the conversion information according to the segmentation start information.
  • the starting information acquiring module includes:
  • a first searching unit configured to search, from a database column information table or a disk management information table, standard column information and conversion information corresponding to the data to be read;
  • a first obtaining unit configured to obtain, from the standard column management table, each sub-point corresponding to the found standard column Segment start information.
  • an embodiment of the present invention provides a data writing apparatus, including:
  • a line number determining module configured to determine a line number of the line data written to the stored data; the stored data is stored by the data processing apparatus in the first possible implementation manner of the fourth aspect;
  • a segment location search module configured to find, according to the row number, a segment location to which the row data to be written belongs in the stored data
  • a row data editing module configured to edit the to-be-written row data according to the set storage column width to conform to the format of the stored data
  • a row writing module for writing row data in a segment of each standard column according to the segment position in the same disk cylinder.
  • the segment location search module includes: a second search unit, configured to search for a location from a database column information table or a disk management information table according to the row number Declaring a segment to which the write row data belongs in the stored data;
  • a third searching unit configured to obtain, from the standard column management table, start information corresponding to the found segment.
  • the segment location searching module includes:
  • a second acquiring unit configured to acquire a starting position of different disks constituting the same physical cylinder by hardware calibration, wherein a starting position on each disk is aligned on the same physical cylinder surface;
  • a fourth searching unit configured to find, according to the starting position and the line number, a starting position of a segment to which the to-be-written line data belongs in the stored data.
  • an embodiment of the present invention provides an electronic device, including: an input device, an output device, a memory, and a processor;
  • the processor performs the following steps:
  • the processor is configured according to the allocated disk
  • the space of the cylinder, dividing and/or combining the data to be stored includes:
  • the column width of the standard column is the storage column width; according to the contiguous space of the allocated disk cylinder and the set segment storage size, each converted The standard column divides at least one segment, and the size of each segment divided is the set segment storage size.
  • the processor determines, according to the set storage column width and the column attribute of the data to be stored, the disk column to be allocated
  • the continuous space of the surface includes:
  • the processor in conjunction with the first possible implementation of the fifth aspect, or the second possible implementation of the fifth aspect, in a third possible implementation, the processor, the same row of data of the data to be stored Storing in the same disk cylinder and continuously storing data in each column segment in the disk cylinder includes:
  • one segment of each standard column is sequentially stored in the allocated disk cylinder, and the data in each segment is continuously stored in order; wherein, the same The number of data rows for all segmentation data in the disk cylinder is the same.
  • the electronic device when the electronic device includes at least two disks, The processor stores the same row of data of the data to be stored in the same disk cylinder, and continuously storing data in each column segment in the disk cylinder includes:
  • each disc on the same physical cylinder surface starts at the starting position, and simultaneously stores the converted segments of each standard column, and the data in each segment is continuously stored in order; , all segment data has the same number of data rows.
  • the processor follows each standard column after the conversion.
  • the column order, in which one segment of each standard column is sequentially stored in the allocated disk cylinder includes: storing one segment of each standard column in turn according to the column order of each standard column after conversion After the allocated disk cylinders, the next segment of each standard column is sequentially stored in the allocated disk cylinder.
  • the disk cylinder is at least one continuous Logical cylinder
  • the disk cylinder is a physical cylinder formed by the at least two disks.
  • the processor is further configured to:
  • a standard column management table is generated for storing the set column width information, the segmentation information corresponding to each standard column, and the starting position information of each segment.
  • the processor also performs the following steps:
  • the acquiring, by the processor, the segmentation start information and the conversion information corresponding to the data to be read includes:
  • an embodiment of the present invention provides an electronic device, including: an input device, an output device, a memory, and a processor;
  • the processor performs the following steps:
  • the line number of the line data is stored in the storage data; searching for the line data to be written according to the line number Describe the segment location to which the data belongs; and edit the row data to be written according to the set storage column width to conform to the format of the stored data; in the same disk cylinder, according to the segment position
  • the row data is written in the segment of each standard column.
  • the processor by using the line number, to find a segment location of the to-be-written row data in the stored data includes:
  • the processor searches for the to-be-written row data according to the line number to belong to the stored data.
  • the segmentation locations include:
  • the same row of data of the data to be stored is stored in the same disk cylinder, and the data in each column segment is continuously stored in the disk cylinder, and the disk only needs to be once.
  • Rotate addressing can complete row writing, and the write performance is close to continuous writing, which solves the technical problem that the column database is slow to write at runtime in the prior art, and greatly improves the writing efficiency of the column storage database; Hardware calibration, so that the standard column is aligned between the discs.
  • you need to read or write the same row but different columns of data since all the heads are aligned in physical position, you can directly read or write in parallel.
  • the data of each column is still continuous on the same disc, and reading or writing a column of data is still the efficiency of continuous reading.
  • FIG. 1 is a schematic flow chart of a first embodiment of a data processing method provided by the present invention
  • FIG. 2 is a schematic flowchart of a second embodiment of a data processing method provided by the present invention
  • FIG. 3 is a schematic diagram of a standard column splitting according to an embodiment of the present invention
  • And/or a schematic diagram of the principle of the merger
  • FIG. 4 is a schematic diagram of the principle of a data processing method provided by the present invention.
  • FIG. 5 is a schematic diagram of a data processing method based on a multi-disc system according to an embodiment of the present invention
  • FIG. 6 is a schematic flowchart of a data reading method according to an embodiment of the present invention
  • FIG. 7 is a schematic flowchart of a data writing method according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a first embodiment of an edit memory module of the present invention.
  • FIG. 10 is a schematic structural diagram of a space determining unit according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a second embodiment of an edit memory module of the present invention.
  • FIG. 12 is a schematic structural diagram of a third embodiment of an edit memory module of the present invention.
  • FIG. 13 is a schematic structural diagram of a start information acquiring module according to an embodiment of the present invention
  • FIG. 14 is a schematic structural diagram of a data writing apparatus according to an embodiment of the present invention
  • FIG. 15 is a schematic structural diagram of a first embodiment of a segment location search module provided by the present invention
  • FIG. 16 is a schematic structural diagram of a second embodiment of a segment location search module provided by the present invention
  • FIG. 17 is an electronic device of the present invention
  • Figure 18 is a schematic view showing the structure of a second embodiment of the electronic apparatus of the present invention. detailed description
  • FIG. 1 is a schematic flowchart of a first embodiment of a data processing method provided by the present invention, where the method includes:
  • Step S100 Obtain data to be stored in a data table in a column storage database.
  • Step S102 Dividing and/or combining the data to be stored according to the allocated space of the disk cylinder; storing the same row of data of the data to be stored in the same disk cylinder, and in the disk column The data in each column segment is continuously stored in the face.
  • the data to be stored in the same data table is obtained, and the same row of data in the same data table is stored in the same disk cylinder by dividing and/or combining the data to be stored, and then the row needs to be written later.
  • it is only necessary to rotate the disk one turn to complete the row writing or row reading of the data which can greatly improve the writing efficiency of the column storage database; and, by using each of the disk cylinders
  • the data in a column of segments is continuously stored, so there is no impact on the column read speed of the column storage.
  • FIG. 2 a schematic flowchart of a second embodiment of the data processing method provided by the present invention, as shown in FIG. 2, details an embodiment of the present invention, including:
  • Step S200 Obtain data to be stored in the same data table in the column storage database
  • Step S202 Determine, according to the set storage column width and the column attribute of the data to be stored, a continuous space of the disk cylinder that needs to be allocated;
  • the column attribute includes width information of each column, and the number of required standard columns may be calculated according to the set storage column width and the column attribute of the data to be stored; and then according to the calculated required standard column quantity and setting
  • the segmentation storage size determines the contiguous space of the disk cylinders that need to be allocated at one time; further:
  • the user can set the storage column width and the segment storage size according to requirements.
  • the storage column width can be regarded as a standard column width, and is used for splitting and/or merging the data to be stored according to the standard column width;
  • the size can be regarded as a standard column segment size, which is used to divide the standard column according to the standard column segment size, and divide at least one segment;
  • the embodiment of the present invention is based on a file system, and the database table is stored in a file in the form of a file.
  • a logical cylinder size applied to the file system is allocated is a continuous size (about 7.8 MByte, or 7.8 MB). Space; then according to the set column width and the column to be stored data Attribute, you can first calculate how many standard columns are needed.
  • the set storage column width (that is, the standard column width) is 1 Byte, and the width of all columns of data to be stored is 7 Bytes, then you can calculate 7 Standard column; further assume that the set segment storage size (ie, standard column segmentation) is 1MB, then the number of data rows in each segment is 1 million rows, assuming that the number of rows of data to be stored is 10 million rows, then Each standard column needs to be divided into 10 segments; it is finally determined that a contiguous space of 10 logical cylinder sizes needs to be allocated.
  • each logical cylinder is continuous, but the logical cylinder and the logical cylinder may be continuous or discontinuous; preferably, more There is a continuous space between the logical cylinders.
  • Step S204 splitting and/or merging all the columns of the data to be stored according to the storage column width, converting into at least one standard column, and recording conversion information;
  • the column width of the standard column is the storage column width;
  • the present invention splits and/or merges all the columns to be stored by setting the storage column width (ie, the standard column width).
  • the data stored in the bottom layer can be consistent in width; assuming that the set standard column width is 512 Bytes, as shown in FIG. 3, the schematic diagram of the standard column splitting and/or merging of the embodiment of the present invention, ' J 1 is 1024 Byte wide, column 2 is 512 Byte wide, column 3 is 256 Byte wide, and column 4 is 256 Byte wide.
  • column 1 can be split into two 512 Byte standard columns, column 2 is not split, column 3 and column 4 Combine into one standard column so that the width of each data is consistent, and record the conversion information (ie, the record mask mask, which is used to read the data).
  • Step S206 Dividing each converted standard column into at least one segment according to the contiguous space of the allocated disk cylinder surface and the set segment storage size, and the size of each segment is determined as the setting. Segmentation storage size;
  • step S202 based on the file system, if the continuous space of the allocated disk cylinder and the set segment storage size, the converted standard column is divided into 10 segments, The size of each segment is 1MB for the set segment storage size, which ensures that the number of rows in each segment data is the same.
  • Step S208 sequentially store one segment of each standard column in the allocated disk cylinder according to the column order of each standard column after conversion, and the data in each segment is continuously stored in order; The same number of data rows for all segment data in the same disk cylinder. Specifically, when each standard column divides at least two segments, one segment of each standard column is sequentially stored in the allocated disk cylinder according to the column order of each standard column after conversion, and then Storing the next segment of each standard column in the allocated disk cylinders in turn;
  • the segment 1 of the standard column 1 , the segment 1 of the standard column 2, and the segment 1 of the standard column 3 are sequentially stored in the first assigned logical cylinder.
  • Segment 1 of the standard column 4 segment 1 of the standard column 5, segment 1 of the standard column 6, and segment 1 of the standard column 7, the segment 2 of the standard column 1 is sequentially stored in the second assigned logical cylinder , Section 2 of the standard column 2, label > ⁇ l 3 ⁇ ⁇ 2, only ⁇ ⁇ 'j 4 2, only ⁇ ⁇ 'j 5 ⁇ ⁇ 2, only ⁇ ⁇ 'j 6 2 and standard Segment 2 of column 7, and so on, until the standard ⁇ ll 1 ⁇ ⁇ 10 is stored in the tenth assigned logical cylinder, and then ⁇ ⁇ ll 2 10 is displayed, ⁇ ⁇ ll 3 ⁇ ⁇ ⁇ 10, ⁇ ll 4 10, segment 10 of standard column 5, segment 10 of standard column 6 and segment 10 of standard column 7; that is, the first 7
  • one logical cylinder of the allocation starts from the disk block No. 1 and terminates to the disk block No. 30; the data to be stored after the step S202 to step S206 is stored in the standard column 1 to the standard column 5, and the standard is displayed in the figure ⁇ .
  • the data of the segment 1 of the column 1 to the standard column 5, the width of each piece of data in the segment 1 is the same; the same row of data in the figure n that is to be stored is stored in the same disk cylinder, and
  • the data in each column segment is continuously stored in the disk cylinder.
  • the first row of data of each standard column will be stored in disk blocks 1, 7, 13, 19 and 25, respectively, or the first column of each standard column.
  • the three rows of data are stored in disk blocks 3, 9, 15, 21, and 27; then, if you want to read the first row of data in the data table, you only need to rotate the disk once to take the first row in the table. All data; and the data in each standard column segment is continuously stored (for example, the segment 1 of the standard column 1 is continuously stored in the disk blocks 1 to 6), then the subsequent reading of a standard column is performed separately.
  • the data is also done in a continuous read.
  • the disk cylinder in the embodiment of the present invention is at least one continuous logical cylinder; specifically, the current device, that is, the current device has no file system, can directly read the hard disk block. That is, the system can directly obtain the starting block number of each logical cylinder and save it in the head of the disk, and each time the logical cylinder allocated to the database is one or more consecutive logical cylinders;
  • the disk cylinder in the embodiment of the present invention is a physical cylinder formed by the at least two disks;
  • Schematic diagram of a data processing method based on a multi-disc system for example, in the same physical cylinder (in cylinder 0) for the same disc (disc 1, disc 2 and disc 3), the same row to be stored The data is aligned vertically, and on the same platter, the same column of data remains contiguous, so that the database can read and write to different columns of the same row of the database in parallel; specifically:
  • step S208 may specifically include: calibrating, by hardware, a starting position of different disks constituting the same physical cylinder, wherein a starting position on each disk is in the same Aligning on the physical cylinder surface; each disc on the same physical cylinder surface starts at the starting position, and simultaneously stores the converted segments of each standard column, and the data in each segment Continuously stored in order; where, all segment data has the same number of data rows.
  • the starting position of different disks constituting the same physical cylinder by hardware calibration may include: correspondingly starting a sector of the physical cylinder with a logical sector number, and calculating each disk in the same physics according to the number of physical heads The number of offset sectors for the alignment of the cylinders, or directly marks the starting position of each disk on each physical cylinder.
  • the embodiment of the present invention may further include: generating a standard column management table, configured to store the set column width information, the segmentation information corresponding to each standard column, and the start location information of each segment. specifically:
  • the segmentation information corresponding to each standard column includes the record conversion information (ie, the mask information) in the above embodiment, and subsequently, according to the information stored in the standard column management table, which of the standard columns of the data to be read is found. In the segment, then the data is read from the beginning of the found segment; or, subsequently, according to the information stored in the standard column management table, which segment of the standard column in which the data to be written is located is located. Then, the cheap position of the write is calculated by the found start position information of the segment, and the data is written.
  • a flow chart of the data reading method provided by the embodiment of the present invention shown in FIG. 6 is described below, and an implementation manner of the data reading method is described corresponding to the data processing method item. , including:
  • Step S600 Acquire segment start information and conversion information corresponding to the data to be read.
  • Step S602 Read corresponding data by using the conversion information according to the segment start information. Specifically, the data to be read is stored by using the foregoing embodiment of the data processing method; the standard column information corresponding to the data to be read and the conversion information may be searched from the database column information table or the disk management information table, and then Obtain the starting information of each segment corresponding to the found standard column from the standard column management table;
  • the standard column information corresponding to a column of data to be read and the conversion information may be searched through the database column information table, that is, the standard column to which the column data to be read belongs is found. And then find the start information of each segment corresponding to the standard column to which it belongs from the standard column management table, and then read the corresponding data and return;
  • the disk management information table records which logical cylinders store data and the order in which the data is stored.
  • the system can read the disk management information table and other database management information into the memory at startup to find The standard column information and the conversion information corresponding to a column of data to be read are extracted, and then the segmentation start information corresponding to the standard column to which it belongs is found from the standard column management table, and then the corresponding data is read and returned.
  • the starting position of the segment of each standard column of the mark and the converted conversion information of the mark can be directly obtained, and the corresponding column corresponding to the standard column is found by using the standard column management table. Segment start information, then read the corresponding data and return.
  • a flow chart of the data writing method provided by the embodiment of the present invention shown in FIG. 7 is described below, and an implementation manner of the data writing method is described corresponding to the data processing method item. , including:
  • Step S700 Determine a line number of writing row data to the stored data.
  • the stored data is stored by using an embodiment of the data processing method; Step S702: Find, according to the line number, a segment position to which the to-be-written line data belongs in the stored data; Storage column width edits the row data to be written to conform to the stored data Format
  • the segment to which the to-be-written row data belongs in the stored data may be searched from the database column information table or the disk management information table according to the row number, and the search is obtained from the standard column management table.
  • the initial information corresponding to the segment is output; then the row data to be written is edited according to the set storage column width to conform to the format of the stored data.
  • Step S704 In the same disk cylinder, the row data is correspondingly written in the segment of each standard column according to the segment position.
  • the segment to which the row data to be written belongs in the stored data may be calculated according to the information in the row number and the database column information table, from the standard column management table. Obtaining start information corresponding to the found segment, and then editing the to-be-written row data according to the set storage column width to conform to the format of the stored data, and calculating the segment to be written The offset position of the row, and then the row data is correspondingly written in the segment of each standard column;
  • the segment to which the row data to be written belongs in the storage data may be calculated according to the information in the row number and the disk management information table, and the segment is obtained from the standard column management table. Searching for the start information corresponding to the segment, and then editing the to-be-written row data according to the set storage column width to conform to the format of the stored data, and calculating the row in the segment to be written Offset position, and then write row data in each of the standard column segments;
  • the starting positions of different discs constituting the same physical cylinder can be calibrated by hardware, wherein the starting position on each disc is aligned on the same physical cylinder surface, according to The starting position and the line number are used to find a starting position of a segment to which the row data to be written belongs in the stored data; that is, the starting position of the segment of each standard column of the tag may be directly obtained, Calculating, according to the line number to be written, the segment to which the row data to be written belongs in the stored data, obtaining the start information corresponding to the found segment from the standard column management table, and then according to the set Storing the column width to edit the row data to be written to conform to the format of the stored data, and calculating the offset position of the row in the segment to be written, and then correspondingly writing in the segment of each standard column Entry data.
  • the disk is only needed once by storing the same row of data of the data to be stored in the same disk cylinder and storing the data in each column segment continuously in the disk cylinder.
  • Rotary addressing can complete row writing, and the write performance is close to continuous writing, which solves the technical problem that the column database is slow to write at runtime in the prior art, and greatly improves the writing efficiency of the column storage database;
  • the hardware can be calibrated so that the standard columns are aligned between the discs. When it is necessary to read or write data of the same row but different columns, since all the heads are aligned in physical position, they can be directly paralleled.
  • the method includes: a data acquisition module 800 and an edit storage module 802, wherein
  • the data acquisition module 800 is configured to acquire data to be stored in the data table in the column storage database; the editing storage module 802 is configured to divide and/or combine the data to be stored according to the allocated space of the disk cylinder; The same row of data of the data to be stored is stored in the same disk cylinder, and the data in each column segment is continuously stored in the disk cylinder.
  • the editing storage module 802 includes: a space determining unit 8020, a converting unit 8022, and a segment dividing unit 8024, wherein
  • the space determining unit 8020 is configured to determine, according to the set storage column width and the column attribute of the data to be stored, a continuous space of the disk cylinder to be allocated;
  • the converting unit 8022 is configured to split and/or merge all the columns of the data to be stored according to the storage column width, convert into at least one standard column, and record conversion information; the column width of the standard column is Storage column width;
  • the segmentation unit 8024 is configured to divide each converted standard column into at least one segment according to the allocated continuous space of the disk cylinder and the set segment storage size, and the size of each segment is The set segmentation storage size.
  • the spatial determining unit 8020 includes a first calculating unit 80200 and a first determining unit 80202, wherein the first calculating unit 80200 is configured to be used according to the setting. Storing the column width and the column attributes of the data to be stored, and calculating the number of standard columns required;
  • the first determining unit 80202 is configured to use the calculated number of required standard columns and the set segmentation according to the calculation Store the size and determine the contiguous space of the disk cylinders that need to be allocated.
  • the edit storage module 802 includes: a space determining unit 8020, a converting unit 8022, and a segment dividing unit 8024, and may further include a segment storage unit 8026, configured to sequentially store one segment of each standard column in the allocated disk cylinder according to the column order of each standard column after conversion, and the data in each segment Continuously stored in order; where all segment data in the same disk cylinder has the same number of data rows. specifically:
  • the first segment storage unit 8026 is specifically configured to: sequentially store one segment of each standard column in the column order of each standard column after conversion. After the allocated disk cylinders, the next segment of each standard column is sequentially stored in the allocated disk cylinder, and the data in each segment is continuously stored in order; wherein, the same disk column The number of rows of data for all segmentation data in the polygon is the same.
  • the editing storage module 802 when the data processing device 80 includes at least two disks, the editing storage module 802 includes: a space determining unit 8020, a conversion unit The 8022 and the segmentation unit 8024 may further include: a hardware calibration unit 8028 and a second segmentation storage unit 80210, where
  • the hardware calibration unit 8028 is configured to calibrate the starting positions of different disks constituting the same physical cylinder by hardware calibration, wherein the starting positions on each of the disks are aligned on the same physical cylinder surface;
  • the second segment storage unit 80210 is configured to start at the starting position for each disk on the same physical cylinder surface, and simultaneously store the converted segments of each standard column, and each segment The data in is continuously stored in order; wherein, all segment data has the same number of data rows.
  • the disk cylinder is at least one continuous logical cylinder; or when the data processing device 80 includes at least two disks, the disk cylinder is A physical cylinder formed by at least two disks.
  • the data processing apparatus 80 may further include a standard column management table generating module, configured to generate a standard column management table, configured to store the set storage column width information, the segmentation information corresponding to each standard column, and each segment. Starting position information.
  • a standard column management table generating module configured to generate a standard column management table, configured to store the set storage column width information, the segmentation information corresponding to each standard column, and each segment. Starting position information.
  • the data processing device 80 may further include a start information obtaining module and a data reading module, where the start information obtaining module is configured to acquire the segment start information corresponding to the data to be read. And the conversion information; the data reading module is configured to use the conversion information to read the corresponding data according to the segmentation start information.
  • a schematic diagram of a structure of a start information acquisition module provided by an embodiment of the present invention includes a first search unit 1300 and a first acquisition unit 1302, wherein
  • the first searching unit 1300 is configured to search, from the database column information table or the disk management information table, standard column information and conversion information corresponding to the data to be read;
  • the first obtaining unit 1302 is configured to obtain, from the standard column management table, each segment start information corresponding to the found standard column.
  • the device 140 includes: a line number determining module 1400, a segment position finding module 1402, a line data editing module 1404, and a line writing module 1406, wherein
  • the line number determining module 1400 is configured to determine a line number for writing the line data to the stored data; the stored data is stored by the data processing apparatus 80;
  • the segment location search module 1402 is configured to search, according to the row number, a segment location to which the row data to be written belongs in the stored data;
  • the line data editing module 1404 is configured to edit the line to be written according to the set storage column width to conform to the format of the stored data
  • the row writing module 1406 is configured to write row data in each of the standard column segments according to the segment position in the same disk cylinder.
  • the segment location finding module 1402 includes a second searching unit 14020 and a third searching unit 14022, wherein
  • the second searching unit 14020 is configured to search, according to the line number, a segment to which the to-be-written row data belongs in the stored data from a database column information table or a disk management information table;
  • the third searching unit 14022 is configured to obtain, from the standard column management table, start information corresponding to the found segment.
  • the segment location searching module 1402 includes: a second obtaining unit 14024 and a fourth searching unit 14026, wherein
  • the second obtaining unit 14024 is configured to acquire a starting position of different disks constituting the same physical cylinder by hardware calibration, wherein a starting position on each disk is aligned on the same physical cylinder surface; a fourth searching unit The 14026 is configured to search, according to the starting position and the line number, a starting position of a segment to which the row data to be written belongs in the stored data.
  • the electronic device 170 includes: an input device 1700, an output device 1702, a memory 1704, and a processor 1706 (the number of processors 1706 in the network device may be one or more, and one processor in Fig. 17 is taken as an example).
  • the input device 1700, the output device 1702, the memory 1704, and the processor 1706 may be connected by a bus or other means, wherein the bus connection is taken as an example in FIG.
  • the processor 1706 performs the following steps:
  • the processor 1706 divides and/or combines the data to be stored according to the allocated space of the disk cylinder, including:
  • the column width of the standard column is the storage column width; according to the contiguous space of the allocated disk cylinder and the set segment storage size, the converted Each standard column is divided into at least one segment, and the size of each segment is divided into the set segment storage size.
  • the processor 1706 determines, according to the set storage column width and the column number attribute of the data to be stored, that the continuous space of the disk cylinder to be allocated includes:
  • the processor 1706 stores the same row of data of the data to be stored in the same disk cylinder, and continuously storing data in each column segment in the disk cylinder includes: The column order of each standard column, in turn, one segment of each standard column is stored in the allocated disk cylinder, and the data in each segment is continuously stored in order; wherein, the same disk cylinder The number of data rows is the same for all segment data in .
  • the processor 1706 stores the same row data of the data to be stored in the same disk cylinder, and segments each column in the disk cylinder. Continuous storage of data in the middle includes:
  • Each disc on the same physical cylinder surface starts at the starting position, and simultaneously stores the converted segments of each standard column, and the data in each segment is continuously stored in order; , all segment data has the same number of data rows.
  • the processor 1706 sequentially stores one segment of each standard column in the allocated disk according to the column order of each standard column after conversion.
  • the cylinder includes:
  • each standard column is sequentially stored in the allocated disk cylinder, and then the next segment of each standard column is sequentially stored in the allocation.
  • the disk is in the cylinder.
  • a standard column management table is generated for storing the set column width information, the segmentation information corresponding to each standard column, and the starting position information of each segment.
  • processor 1706 further performs the following steps:
  • the processor 1706 acquires the segmentation start information corresponding to the data to be read and the conversion information includes:
  • the standard column information corresponding to the data to be read and the conversion information are searched from the database column information table or the disk management information table; and the start information of each segment corresponding to the found standard column is obtained from the standard column management table.
  • the electronic device 170 of the embodiment of the present invention includes, but is not limited to, an electronic device such as a computer, a data warehouse storage integrated machine.
  • FIG. 18 is a schematic structural diagram of a second embodiment of the electronic device of the present invention, which is described in detail:
  • the electronic device 180 includes: an input device 1800, an output device 1802, a memory 1804, and a processor 1806 (the number of processors 1806 in the network device may be one or more, and one processor in FIG. 18 is taken as an example).
  • the input device 1800, the output device 1802, the memory 1804, and the processor 1806 may be connected by a bus or other means, wherein the bus connection is taken as an example in FIG.
  • the processor 1806 performs the following steps:
  • the data to be read is stored by the data processing method of the embodiment of the present invention; and searching for the segment to which the line data to be written belongs in the stored data according to the line number Positioning and editing the to-be-written row data according to the set storage column width to conform to the format of the stored data; in the same disk cylinder, segmentation in each standard column according to the segmentation position The corresponding row data is written.
  • processor 1806 searches for the row data to be written in the storage number according to the line number.
  • the segment locations to which it belongs include:
  • the processor 1806 searches for the segment location of the to-be-written row data in the stored data according to the line number, including:
  • the electronic device 180 of the embodiment of the present invention includes, but is not limited to, an electronic device such as a computer or a data warehouse storage integrated machine.
  • the same row of data of the data to be stored is stored in the same disk cylinder, and the data in each column segment is continuously stored in the disk cylinder.
  • the disk can be written in a single rotation address, and the write performance is close to continuous writing, which solves the technical problem that the write speed of the column database in the prior art is slow at runtime, and greatly improves the writing efficiency of the column storage database.
  • the hardware can be calibrated so that the standard columns are aligned between the discs.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

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

Abstract

一种数据处理方法,数据写入方法,相关装置和设备。数据处理方法包括:获取列存储数据库中数据表的待存储数据;根据分配的磁盘柱面的空间,对所述待存储数据进行划分/或组合;将所述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续存储。解决了现有技术中列数据库在运行时写入速度慢的技术问题,大大提高列存储数据库的写入效率,另外还可以通过硬件标定直接并行读入或写入。

Description

一种数据处理和写入方法及相关装置 技术领域
本发明涉及计算机领域, 尤其涉及一种数据处理方法、数据写入方法及相 关装置。 背景技术
列存储数据库是一种查询速度很快的数据库,它通过将关系数据库中的一 个表 relation拆分为多个纵列 column分别存储从而使得数据库可以在查询时一 次读入一整列的数据; 其好处是可以降低数据库投影运算的消耗: 在查询时, 不用读取整个 relation数据,只需要读取对应的列,大幅降低了读取 10的数量; 但是列数据库的存储方式导致列数据库的写操作要慢于传统的行式数据库; 现有的列存储技术是将关系数据库的列拆分出来单独存放,那么在进行行 写入时, 需要同时修改所有的列, 然而因为列被拆分存储了, 造成行写入硬盘 需要进行多次寻址, 写入效率相当于随机写, 该随机写速度会远慢于连续写, 从而使列存储数据库写入效率很低。 发明内容
本发明实施例所要解决的技术问题在于,提供一种数据处理方法、数据写 入方法及相关装置,解决了现有技术中列数据库在运行时写入速度慢的技术问 题, 大大提高列存储数据库的写入效率。
第一方面, 本发明实施例提供了一种数据处理方法, 包括:
获取列存储数据库中数据表的待存储数据;
根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合; 将 所述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中 对每一列分段中的数据进行连续存储。
结合第一方面,在第一种可能的实现方式中, 所述根据分配的磁盘柱面的 空间, 对所述待存储数据进行划分和 /或组合包括: 根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱 面的连续空间;
根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或合并, 转化 为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存放列宽; 根据分配的磁盘柱面的连续空间和设定的分段存放大小,将转化后的每个 标准列划分出至少一个分段,划分出的每一个分段的大小为所述设定的分段存 放大小。
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中, 所 述根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱面 的连续空间包括:
根据设定的存放列宽和所述待存储数据的列属性, 计算需要标准列的数 量;
根据计算出的需要标准列的数量和设定的分段存放大小,确定需要分配的 磁盘柱面的连续空间。
结合第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实 现方式,在第三种可能的实现方式中, 所述将所述待存储数据的同一行数据存 储在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续 存储包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个 磁盘柱面中的所有分段数据的数据行数相同。
结合第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实 现方式, 在第四种可能的实现方式中, 当本端设备包括至少两个盘片时, 所述 将所述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面 中对每一列分段中的数据进行连续存储包括:
通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片 上的起始位置在所述同一个物理柱面上对齐;
在所述同一个物理柱面上的每个盘片以所述起始位置开始,同时存入转化 后的每个标准列的分段, 且每个分段中的数据按顺序连续存储; 其中, 所有分 段数据的数据行数相同。
结合第一方面的第三种可能的实现方式,在第五种可能的实现方式中, 当 每个标准列划分出至少两个分段时, 所述按照转化后的每个标准列的列顺序, 依次将每个标准列的一个分段存储在所述分配的磁盘柱面中包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中。
结合第一方面, 或者第一方面的第一种可能的实现方式, 或者第一方面的 第二种可能的实现方式, 或者第一方面的第三种可能的实现方式, 或者第一方 面的第四种可能的实现方式, 或者第一方面的第五种可能的实现方式,在第六 种可能的实现方式中, 当本端设备为棵设备时, 所述磁盘柱面为至少一个连续 的逻辑柱面; 或
当本端设备包括至少两个盘片时,所述磁盘柱面为所述至少两个盘片构成 的物理柱面。
结合第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实 现方式, 或者第一方面的第三种可能的实现方式, 或者第一方面的第四种可能 的实现方式, 或者第一方面的第五种可能的实现方式,在第七种可能的实现方 式中, 所述方法还包括: 生成标准列管理表, 用于存储设定的存放列宽信息、 各标准列对应的分段信息以及每个分段的起始位置信息。
结合第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实 现方式, 或者第一方面的第三种可能的实现方式, 或者第一方面的第四种可能 的实现方式, 或者第一方面的第五种可能的实现方式, 或者第一方面的第六种 可能的实现方式, 或者第一方面的第七种可能的实现方式,在第八种可能的实 现方式中, 所述方法还包括:
获取所述待读取数据对应的分段起始信息以及转化信息;
根据所述分段起始信息, 利用所述转化信息读取对应的数据。
结合第一方面的第八种可能的实现方式,在第九种可能的实现方式中, 所 述获取所述待读取数据对应的分段起始信息以及转化信息包括:
从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准 列信息以及转化信息;
从标准列管理表中获取查找到的标准列对应的各个分段起始信息。
第二方面, 本发明实施例提供了数据写入方法, 包括:
确定向存储数据中写入行数据的行号;所述存储数据以第一方面的第二种 可能的实现方式的数据处理方法进行存储;
根据所述行号查找待写入行数据在所述存储数据中所属的分段位置;并根 据设定的存放列宽编辑所述待写入行数据, 以符合所述存储数据的格式; 在同一个磁盘柱面中,根据所述分段位置在每一个标准列的分段中对应写 入行数据。
结合第二方面,在第一种可能的实现方式中, 所述根据所述行号查找待写 入行数据在所述存储数据中所属的分段位置包括:
根据所述行号,从数据库列信息表或磁盘管理信息表中查找所述待写入行 数据在所述存储数据中所属的分段;
从标准列管理表中获取所述查找出的分段对应的起始信息。
结合第二方面,在第二种可能的实现方式中, 当本端设备包括至少两个盘 片时,所述根据所述行号查找待写入行数据在所述存储数据中所属的分段位置 包括:
获取通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个 盘片上的起始位置在所述同一个物理柱面上对齐;
根据所述起始位置和所述行号,查找待写入行数据在所述存储数据中所属 的分段的起始位置。
第三方面, 本发明实施例提供了一种数据处理装置, 包括:
数据获耳 ^莫块, 用于获取列存储数据库中数据表的待存储数据; 编辑存储模块, 用于根据分配的磁盘柱面的空间,对所述待存储数据进行 划分和 /或组合; 将所述待存储数据的同一行数据存储在同一个磁盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储。
结合第三方面, 在第一种可能的实现方式中, 所述编辑存储模块包括: 空间确定单元, 用于根据设定的存放列宽和所述待存储数据的列属性,确 定需要分配的磁盘柱面的连续空间; 转化单元,用于根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所 述存放列宽;
分段划分单元,用于根据分配的磁盘柱面的连续空间和设定的分段存放大 小,将转化后的每个标准列划分出至少一个分段, 划分出的每一个分段的大小 为所述设定的分段存放大小。
结合第三方面的第一种可能的实现方式,在第二种可能的实现方式中, 所 述空间确定单元包括:
第一计算单元, 用于根据设定的存放列宽和所述待存储数据的列属性,计 算需要标准列的数量;
第一确定单元,用于根据计算出的需要标准列的数量和设定的分段存放大 小, 确定需要分配的磁盘柱面的连续空间。
结合第三方面的第一种可能的实现方式,或者第三方面的第二种可能的实 现方式, 在第三种可能的实现方式中, 所述编辑存储模块还包括:
第一分段存储单元, 用于按照转化后的每个标准列的列顺序,依次将每个 标准列的一个分段存储在所述分配的磁盘柱面中,且每个分段中的数据按顺序 连续存储; 其中, 同一个磁盘柱面中的所有分段数据的数据行数相同。
结合第三方面的第一种可能的实现方式,或者第三方面的第二种可能的实 现方式,在第四种可能的实现方式中, 当所述数据处理装置包括至少两个盘片 时, 所述编辑存储模块还包括:
硬件标定单元,用于通过硬件标定构成同一个物理柱面的不同盘片的起始 位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐;
第二分段存储单元,用于在所述同一个物理柱面上的每个盘片以所述起始 位置开始, 同时存入转化后的每个标准列的分段,且每个分段中的数据按顺序 连续存储; 其中, 所有分段数据的数据行数相同。
结合第三方面的第三种可能的实现方式,在第五种可能的实现方式中, 当 每个标准列划分出至少两个分段时, 所述第一分段存储单元具体用于:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个磁盘柱面中 的所有分段数据的数据行数相同。
结合第三方面, 或者第三方面的第一种可能的实现方式, 或者第三方面的 第二种可能的实现方式,或者第三方面的第三种可能的实现方式,或者第三方 面的第四种可能的实现方式, 或者第三方面的第五种可能的实现方式,在第六 种可能的实现方式中, 当所述数据处理装置为棵设备时, 所述磁盘柱面为至少 一个连续的逻辑柱面; 或
当所述数据处理装置包括至少两个盘片时,所述磁盘柱面为所述至少两个 盘片构成的物理柱面。
结合第三方面的第一种可能的实现方式,或者第三方面的第二种可能的实 现方式, 或者第三方面的第三种可能的实现方式, 或者第三方面的第四种可能 的实现方式, 或者第三方面的第五种可能的实现方式,在第七种可能的实现方 式中, 所述数据处理装置还包括:
标准列管理表生成模块, 用于生成标准列管理表, 用于存储设定的存放列 宽信息、 各标准列对应的分段信息以及每个分段的起始位置信息。
结合第三方面的第一种可能的实现方式,或者第三方面的第二种可能的实 现方式, 或者第三方面的第三种可能的实现方式, 或者第三方面的第四种可能 的实现方式, 或者第三方面的第五种可能的实现方式,或者第三方面的第六种 可能的实现方式,或者第三方面的第七种可能的实现方式,在第八种可能的实 现方式中, 所述数据处理装置还包括:
起始信息获取模块,用于获取所述待读取数据对应的分段起始信息以及转 化信息;
数据读取模块, 用于根据所述分段起始信息, 利用所述转化信息读取对应 的数据。
结合第三方面的第八种可能的实现方式,在第九种可能的实现方式中, 所 述起始信息获取模块包括:
第一查找单元,用于从数据库列信息表或磁盘管理信息表中查找所述待读 取数据对应的标准列信息以及转化信息;
第一获取单元,用于从标准列管理表中获取查找到的标准列对应的各个分 段起始信息。
第四方面, 本发明实施例提供了一种数据写入装置, 包括:
行号确定模块, 用于确定向存储数据中写入行数据的行号; 所述存储数据 以上述第四方面的第一种可能的实现方式中的数据处理装置进行存储;
分段位置查找模块,用于根据所述行号查找待写入行数据在所述存储数据 中所属的分段位置;
行数据编辑模块,用于根据设定的存放列宽编辑所述待写入行数据, 以符 合所述存储数据的格式;
行写入模块, 用于在同一个磁盘柱面中,根据所述分段位置在每一个标准 列的分段中对应写入行数据。
结合第四方面,在第一种可能的实现方式中,所述分段位置查找模块包括: 第二查找单元, 用于根据所述行号,从数据库列信息表或磁盘管理信息表 中查找所述待写入行数据在所述存储数据中所属的分段;
第三查找单元,用于从标准列管理表中获取所述查找出的分段对应的起始 信息。
结合第四方面,在第二种可能的实现方式中, 当所述数据写入装置包括至 少两个盘片时, 所述分段位置查找模块包括:
第二获取单元,用于获取通过硬件标定构成同一个物理柱面的不同盘片的 起始位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐;
第四查找单元, 用于根据所述起始位置和所述行号, 查找待写入行数据在 所述存储数据中所属的分段的起始位置。
第五方面, 本发明实施例提供了一种电子设备, 包括: 输入装置、 输出装 置、 存储器和处理器;
其中, 所述处理器执行如下步骤:
获取列存储数据库中数据表的待存储数据; 根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合; 将所述待存储数据的同一行数据存储 在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续存 储。
结合第五方面,在第一种可能的实现方式中, 所述处理器根据分配的磁盘 柱面的空间 , 对所述待存储数据进行划分和 /或组合包括:
根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱 面的连续空间; 根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或 合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存 放列宽;根据分配的磁盘柱面的连续空间和设定的分段存放大小,将转化后的 每个标准列划分出至少一个分段,划分出的每一个分段的大小为所述设定的分 段存放大小。
结合第五方面的第一种可能的实现方式,在第二种可能的实现方式中, 所 述处理器根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁 盘柱面的连续空间包括:
根据设定的存放列宽和所述待存储数据的列属性, 计算需要标准列的数 量; 根据计算出的需要标准列的数量和设定的分段存放大小,确定需要分配的 磁盘柱面的连续空间。
结合第五方面的第一种可能的实现方式,或者第五方面的第二种可能的实 现方式,在第三种可能的实现方式中, 所述处理器将所述待存储数据的同一行 数据存储在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进 行连续存储包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个 磁盘柱面中的所有分段数据的数据行数相同。
结合第五方面的第一种可能的实现方式,或者第五方面的第二种可能的实 现方式, 在第四种可能的实现方式中, 所述电子设备包括至少两个盘片时, 所 述处理器将所述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述 磁盘柱面中对每一列分段中的数据进行连续存储包括:
通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片 上的起始位置在所述同一个物理柱面上对齐;
在所述同一个物理柱面上的每个盘片以所述起始位置开始,同时存入转化 后的每个标准列的分段, 且每个分段中的数据按顺序连续存储; 其中, 所有分 段数据的数据行数相同。 结合第五方面的第三种可能的实现方式,在第五种可能的实现方式中, 当 每个标准列划分出至少两个分段时,所述处理器按照转化后的每个标准列的列 顺序, 依次将每个标准列的一个分段存储在所述分配的磁盘柱面中包括: 按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中。
结合第五方面, 或者第五方面的第一种可能的实现方式, 或者第五方面的 第二种可能的实现方式, 或者第五方面的第三种可能的实现方式, 或者第五方 面的第四种可能的实现方式, 或者第五方面的第五种可能的实现方式,在第六 种可能的实现方式中, 当所述电子设备为棵设备时, 所述磁盘柱面为至少一个 连续的逻辑柱面; 或
当所述电子设备包括至少两个盘片时,所述磁盘柱面为所述至少两个盘片 构成的物理柱面。
结合第五方面的第一种可能的实现方式,或者第五方面的第二种可能的实 现方式, 或者第五方面的第三种可能的实现方式, 或者第五方面的第四种可能 的实现方式, 或者第五方面的第五种可能的实现方式,在第七种可能的实现方 式中, 所述处理器还执行:
生成标准列管理表, 用于存储设定的存放列宽信息、各标准列对应的分段 信息以及每个分段的起始位置信息。
结合第五方面的第一种可能的实现方式,或者第五方面的第二种可能的实 现方式, 或者第五方面的第三种可能的实现方式, 或者第五方面的第四种可能 的实现方式, 或者第五方面的第五种可能的实现方式, 或者第五方面的第六种 可能的实现方式, 或者第五方面的第七种可能的实现方式,在第八种可能的实 现方式中, 所述处理器还执行如下步骤:
获取所述待读取数据对应的分段起始信息以及转化信息;根据所述分段起 始信息, 利用所述转化信息读取对应的数据。
结合第五方面的第八种可能的实现方式,在第九种可能的实现方式中, 所 述处理器获取所述待读取数据对应的分段起始信息以及转化信息包括:
从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准 列信息以及转化信息;从标准列管理表中获取查找到的标准列对应的各个分段 起始信息。
第六方面, 本发明实施例提供了一种电子设备, 包括: 输入装置、 输出装 置、 存储器和处理器;
其中, 所述处理器执行如下步骤:
确定向存储数据中写入行数据的行号;所述存储数据以上述第一方面的第 一可能的实现方式中的数据处理方法进行存储;根据所述行号查找待写入行数 据在所述存储数据中所属的分段位置;并根据设定的存放列宽编辑所述待写入 行数据, 以符合所述存储数据的格式; 在同一个磁盘柱面中, 根据所述分段位 置在每一个标准列的分段中对应写入行数据。
结合第六方面,在第一种可能的实现方式中, 所述处理器根据所述行号查 找待写入行数据在所述存储数据中所属的分段位置包括:
根据所述行号,从数据库列信息表或磁盘管理信息表中查找所述待写入行 数据在所述存储数据中所属的分段;从标准列管理表中获取所述查找出的分段 对应的起始信息。
结合第六方面,在第二种可能的实现方式中, 当所述电子设备包括至少两 个盘片时,所述处理器根据所述行号查找待写入行数据在所述存储数据中所属 的分段位置包括:
获取通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个 盘片上的起始位置在所述同一个物理柱面上对齐;根据所述起始位置和所述行 号, 查找待写入行数据在所述存储数据中所属的分段的起始位置。
通过实施本发明实施例,将所述待存储数据的同一行数据存储在同一个磁 盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储,磁盘只 需一次旋转寻址即可完成行写入, 写入性能接近连续写,解决了现有技术中列 数据库在运行时写入速度慢的技术问题, 大大提高列存储数据库的写入效率; 另外还可以通过硬件标定,使得标准列在盘片之间是对齐的,那么当需要读取 或者写入同一行但是不同列的数据时, 由于所有磁头在物理位置上是对齐的, 可以直接并行读入或者写入; 同时每一列的数据仍然在同一盘片上保持连续, 读或者写一列数据仍旧是连续读的效率。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例或现有技术描述中所需要使用的附图作筒单地介绍,显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付 出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明提供的数据处理方法的第一实施例的流程示意图; 图 2是本发明提供的数据处理方法的第二实施例的流程示意图; 图 3是本发明实施例的标准列拆分和 /或合并的原理示意图;
图 4是本发明提供的数据处理方法的原理示意图;
图 5是本发明实施例的基于多盘片系统的数据处理方法的原理示意图; 图 6是本发明实施例提供的数据读取方法的流程示意图;
图 7是本发明实施例提供的数据写入方法的流程示意图;
图 8是本发明实施例提供的数据处理装置的结构示意图;
图 9是本发明的编辑存储模块的第一实施例的结构示意图;
图 10是本发明实施例的空间确定单元的结构示意图;
图 11是本发明的编辑存储模块的第二实施例的结构示意图;
图 12是本发明的编辑存储模块的第三实施例的结构示意图;
图 13是本发明实施例提供的起始信息获取模块的结构示意图; 图 14是本发明实施例提供的数据写入装置的结构示意图;
图 15是本发明提供的分段位置查找模块的第一实施例的结构示意图; 图 16是本发明提供的分段位置查找模块的第二实施例的结构示意图; 图 17是本发明的电子设备的第一实施例的结构示意图;
图 18是本发明的电子设备的第二实施例的结构示意图。 具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 参见图 1 , 是本发明提供的数据处理方法的第一实施例的流程示意图, 该 方法包括:
步骤 S100: 获取列存储数据库中数据表的待存储数据;
步骤 S102: 根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 / 或组合; 将所述待存储数据的同一行数据存储在同一个磁盘柱面中, 并在所述 磁盘柱面中对每一列分段中的数据进行连续存储。
具体地, 获取同一个数据表的待存储数据,通过对待存储数据进行划分和 /或组合, 将同一个数据表中的同一行数据存储在同一个磁盘柱面中, 那么当 后续需要进行行写入或行读取时,只需将磁盘旋转一圈即可完成数据的行写入 或行读取, 可大大提高列存储数据库的写入效率; 并且, 通过在所述磁盘柱面 中对每一列分段中的数据进行连续存储,因此不会对列存储原有优势的列读取 速度产生影响。
进一步地,如图 2示出的本发明提供的数据处理方法的第二实施例的流程 示意图, 详细说明本发明的实施方式, 包括:
步骤 S200: 获取列存储数据库中同一个数据表的待存储数据;
步骤 S202: 根据设定的存放列宽和所述待存储数据的列属性, 确定需要 分配的磁盘柱面的连续空间;
具体地, 列属性包括各列的宽度信息, 可以根据设定的存放列宽和所述待 存储数据的列属性,计算需要标准列的数量; 然后根据计算出的需要标准列的 数量和设定的分段存放大小,确定需要一次分配的磁盘柱面的连续空间; 进一 步地:
用户可以根据需求设定存放列宽和分段存放大小,该存放列宽可以看作标 准列宽, 用于按照该标准列宽对该待存储数据进行拆分和 /或合并; 该分段存 放大小可以看作标准列分段大小,用于按照该标准列分段大小对标准列进行划 分, 划分出至少一个分段;
假设本发明实施例基于文件系统,数据库表是以文件的形式存放在磁盘中 的, 每次向文件系统申请分配的一个逻辑柱面大小是固定大小 (约为 7.8 MByte, 即 7.8MB )的连续空间; 那么根据设定的存放列宽和待存储数据的列 属性,可以先计算出需要多少个标准列,假设,设定的存放列宽(即标准列宽) 为 1 Byte, 待存储数据的所有列数的宽度共 7 Byte, 那么可以计算出需要 7个 标准列; 进一步假设设定的分段存放大小 (即标准列分段) 为 1MB, 那么每 一个分段中的数据行数为 100万行, 假设待存储数据的行数为 1000万行, 那 么每个标准列需要划分出 10个分段;最终确定需要分配 10个逻辑柱面大小的 连续空间。 需要说明的是, 当基于文件系统分配多个的逻辑柱面时, 每一个逻 辑柱面的空间是连续的, 但逻辑柱面与逻辑柱面之间可以连续也可以不连续; 优选地, 多个逻辑柱面之间为连续空间。
步骤 S204: 根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或 合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存 放列宽;
具体地, 在实际的数据库应用中, 不同的列的实际宽度是不相同的, 所以 本发明通过设定存放列宽(即标准列宽), 对待存储数据的所有列尽心拆分和 / 或合并, 让存放在底层的数据在宽度上可以保持一致; 假设, 设定的标准列宽 为 512 Byte, 如图 3示出的本发明实施例的标准列拆分和 /或合并的原理示意 图, 歹' J 1宽 1024Byte, 列 2宽 512 Byte, 列 3宽 256 Byte, 列 4宽 256Byte, 那么可以将列 1拆分成两个 512 Byte的标准列, 列 2不拆分, 列 3和列 4合 并为 1个标准列, 使得每一个数据的宽度上都保持一致, 并记录转化信息(即 记录掩码 mask, 后续用于读取数据)。
步骤 S206: 根据分配的磁盘柱面的连续空间和设定的分段存放大小, 将 转化后的每个标准列划分出至少一个分段,划分出的每一个分段的大小为所述 设定的分段存放大小;
具体地, 以步骤 S202中的描述为例, 基于文件系统, 假如根据分配的磁 盘柱面的连续空间和设定的分段存放大小, 将转化后的每个标准列划分出 10 个分段, 划分出的每一个分段的大小为设定的分段存放大小 1MB, 即可保证 每一个分段数据中的行数相同。
步骤 S208: 按照转化后的每个标准列的列顺序, 依次将每个标准列的一 个分段存储在所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个磁盘柱面中的所有分段数据的数据行数相同。 具体地,每个标准列划分出至少两个分段时,按照转化后的每个标准列的 列顺序,依次将每个标准列的一个分段存储在所述分配的磁盘柱面后,再依次 将每个标准列的下一个分段存储在所述分配的磁盘柱面中;
同样以步骤 S202中的描述为例, 基于文件系统, 在第一个分配的逻辑柱 面中依次存储标准列 1的分段 1 , 标准列 2的分段 1 , 标准列 3的分段 1 , 标 准列 4的分段 1 , 标准列 5的分段 1 , 标准列 6的分段 1和标准列 7的分段 1 , 第二个分配的逻辑柱面中依次存储标准列 1的分段 2, 标准列 2的分段 2, 标 〉 歹l 3 ό^ Ι 2, 才示〉 歹 'j 4 2, 才示〉 歹 'j 5 ό^ Ι 2, 才示〉 歹 'j 6 2 和标准列 7的分段 2, 依次类推, 直到第十个分配的逻辑柱面中依次存储标准 歹 ll 1 ό^ Ι 10,才示〉 歹 ll 2 10,才示〉 歹 ll 3 ό^ Ι 10,才示〉 歹 ll 4 10, 标准列 5的分段 10, 标准列 6的分段 10和标准列 7的分段 10; 即其中一个逻 辑柱面的前 7ΜΒ为标准列分段, 剩余的约 0.8ΜΒ用于记录其它信息(如删除 标记等信息); 另外, 每一个分段中的数据是按照顺序连续存储的, 即保证待 存储数据中每标准列的分段中的数据是连续存放的,因此后续读取某一列的数 据时, 可以一次连续读取。 再进一步地, 结合图 4示出的本发明提供的数据处理方法的原理示意图, 举例说明本发明实施例的具体实施方式:
假设分配的一个逻辑柱面起始为 1号磁盘块, 终止为 30号磁盘块; 经过 步骤 S202至步骤 S206整理后的待存储数据有标准列 1至标准列 5, 图 η中显 示的是标准列 1至标准列 5的分段 1的数据,分段 1中每一格数据的宽度一致; 图 η中完成了对待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述 磁盘柱面中对每一列分段中的数据进行连续存储,例如每一个标准列的第一行 数据将分别存放在磁盘块 1、 7、 13、 19和 25中, 或每一个标准列的第三行数 据分别存放在磁盘块 3、 9、 15、 21和 27中; 那么后续若要读取数据表中第一 行数据时, 只需磁盘旋转一圈即可取出该表中第一行的全部数据; 且每一标准 列的分段中数据时连续存放的(例如标准列 1的分段 1中连续存放在磁盘块 1 至 6中), 那么后续若要单独读取某一标准列的数据也是进行一次连续读即可 完成。 可理解的, 当本端设备为棵设备时,本发明实施例中的磁盘柱面为至少一 个连续的逻辑柱面; 具体地, 棵设备即当前设备没有文件系统, 可以直接读取 硬盘块, 即系统可以直接获取每一个逻辑柱面的起始块号并保存在磁盘首部, 且每次给数据库分配的逻辑柱面是一个或多个连续的逻辑柱面;
再可理解的, 当本端设备包括至少两个盘片时,本发明实施例中的磁盘柱 面为所述至少两个盘片构成的物理柱面;如图 5示出的本发明实施例的基于多 盘片系统的数据处理方法的原理示意图, 例如在同一物理柱面(柱面 0中)针 对不同盘片 (盘片 1、 盘片 2和盘片 3 ) , 将待存储的同一行数据在纵向上对 齐, 而在同一盘片上, 同一列数据仍保持连续, 那么可以使得数据库可以对数 据库的同一行的不同列进行并行读写; 具体地:
当本端设备包括至少两个盘片时, 步骤 S208可以具体包括: 通过硬件标 定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片上的起始位置在 所述同一个物理柱面上对齐;在所述同一个物理柱面上的每个盘片以所述起始 位置开始, 同时存入转化后的每个标准列的分段,且每个分段中的数据按顺序 连续存储; 其中, 所有分段数据的数据行数相同。 其中, 通过硬件标定构成同 一个物理柱面的不同盘片的起始位置可以包括:将物理柱面的起始扇区与逻辑 扇区号进行对应,根据物理磁头数计算每一个盘片在同一物理柱面的对齐位置 的偏移扇区数, 或者直接标记出每一个盘片在每一个物理柱面上的起始位置。
再进一步地, 本发明实施例还可以包括: 生成标准列管理表, 用于存储设 定的存放列宽信息、 各标准列对应的分段信息以及每个分段的起始位置信息。 具体地:
该各标准列对应的分段信息包括上述实施例中的记录转化信息 (即 mask 信息), 后续可以根据标准列管理表中存储的信息, 查找到需要读取的数据在 哪个标准列的哪个分段中, 然后从查找到的分段的起始位置开始, 读取数据; 或,后续也可以根据标准列管理表中存储的信息, 查找需要写入的数据位于哪 个标准列的哪个分段中,然后通过查找到的分段的起始位置信息计算写入的便 宜位置, 进行数据的写入。 为了便于更好地实施本发明实施例的上述方案,下面结合图 6示出的本发 明实施例提供的数据读取方法的流程示意图,对应上述数据处理方法项来描述 数据读取方法的实施方式, 包括:
步骤 S600: 获取待读取数据对应的分段起始信息以及转化信息; 步骤 S602: 根据所述分段起始信息, 利用所述转化信息读取对应的数据。 具体地, 该待读取数据是通过上述数据处理方法的实施例进行了存储; 可 以从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准列 信息以及转化信息,然后从标准列管理表中获取查找到的标准列对应的各个分 段起始信息; 详细地:
当本端为文件系统时,可以通过数据库列信息表查找所要读取的某列数据 对应的标准列信息以及转化信息(即 mask信息 ), 即查找到要读取的某列数据 所属的标准列,然后从标准列管理表中查找到所属的标准列对应的各个分段起 始信息, 然后读取对应数据并返回;
当本端为棵设备时,磁盘管理信息表记录有哪些逻辑柱面存放哪些数据以 及存放该数据的顺序,系统可以在启动时将该磁盘管理信息表以及其它数据库 的管理信息读入内存,查找出要读取的某列数据对应的标准列信息以及转化信 息, 然后从标准列管理表中查找到所属的标准列对应的各个分段起始信息, 然 后读取对应数据并返回。
可理解的, 当本端包括多盘片系统时, 可以直接获取标记的各个标准列的 分段的起始位置以及记录的转化信息, 结合标准列管理表查找到所属的标准 列对应的各个分段起始信息, 然后读取对应数据并返回。 为了便于更好地实施本发明实施例的上述方案,下面结合图 7示出的本发 明实施例提供的数据写入方法的流程示意图,对应上述数据处理方法项来描述 数据写入方法的实施方式, 包括:
步骤 S700: 确定向存储数据中写入行数据的行号;
具体地, 所述存储数据是通过上述数据处理方法的实施例进行了存储; 步骤 S702: 根据所述行号查找待写入行数据在所述存储数据中所属的分 段位置; 并根据设定的存放列宽编辑所述待写入行数据, 以符合所述存储数据 的格式;
具体地, 可以根据所述行号,从数据库列信息表或磁盘管理信息表中查找 所述待写入行数据在所述存储数据中所属的分段,从标准列管理表中获取所述 查找出的分段对应的起始信息;然后根据设定的存放列宽编辑所述待写入行数 据, 以符合所述存储数据的格式。
步骤 S704: 在同一个磁盘柱面中, 根据所述分段位置在每一个标准列的 分段中对应写入行数据。
具体地: 当本端为文件系统时, 可以根据所述行号和数据库列信息表中的 信息,计算出待写入行数据在所述存储数据中所属的分段,从标准列管理表中 获取所述查找出的分段对应的起始信息,然后根据设定的存放列宽编辑所述待 写入行数据, 以符合所述存储数据的格式, 并计算出要写入的分段内的行的偏 移位置, 然后在每一个标准列的分段中对应写入行数据;
当本端为棵设备时, 可以根据所述行号和磁盘管理信息表中的信息,计算 出待写入行数据在所述存储数据中所属的分段,从标准列管理表中获取所述查 找出的分段对应的起始信息, 然后根据设定的存放列宽编辑所述待写入行数 据, 以符合所述存储数据的格式, 并计算出要写入的分段内的行的偏移位置, 然后在每一个标准列的分段中对应写入行数据;
当本端包括多盘片系统时,可以通过硬件标定构成同一个物理柱面的不同 盘片的起始位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐, 根据所述起始位置和所述行号,查找待写入行数据在所述存储数据中所属的分 段的起始位置; 即, 可以直接获取标记的各个标准列的分段的起始位置, 根据 要写入的行号计算出待写入行数据在所述存储数据中所属的分段,从标准列管 理表中获取所述查找出的分段对应的起始信息,然后根据设定的存放列宽编辑 所述待写入行数据, 以符合所述存储数据的格式, 并计算出要写入的分段内的 行的偏移位置, 然后在每一个标准列的分段中对应写入行数据。
实施本发明实施例,通过将所述待存储数据的同一行数据存储在同一个磁 盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储,磁盘只 需一次旋转寻址即可完成行写入, 写入性能接近连续写,解决了现有技术中列 数据库在运行时写入速度慢的技术问题, 大大提高列存储数据库的写入效率; 另外还可以通过硬件标定,使得标准列在盘片之间是对齐的,那么当需要读取 或者写入同一行但是不同列的数据时, 由于所有磁头在物理位置上是对齐的, 可以直接并行读入或者写入; 同时每一列的数据仍然在同一盘片上保持连续, 读或者写一列数据仍旧是连续读的效率。 为了便于更好地实施本发明实施例的上述方案,下面结合图 8示出的本发 明实施例提供的数据处理装置的结构示意图,对应上述方法项来描述装置项的 实施方式, 数据处理装置 80包括: 数据获取模块 800和编辑存储模块 802, 其中
数据获耳 ^莫块 800用于获取列存储数据库中数据表的待存储数据; 编辑存储模块 802用于根据分配的磁盘柱面的空间,对所述待存储数据进 行划分和 /或组合; 将所述待存储数据的同一行数据存储在同一个磁盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储。
进一步地,如图 9示出的本发明的编辑存储模块的第一实施例的结构示意 图, 编辑存储模块 802包括: 空间确定单元 8020、 转化单元 8022和分段划分 单元 8024, 其中
空间确定单元 8020 用于根据设定的存放列宽和所述待存储数据的列属 性, 确定需要分配的磁盘柱面的连续空间;
转化单元 8022用于根据所述存放列宽对所述待存储数据的所有列进行拆 分和 /或合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽 为所述存放列宽;
分段划分单元 8024用于根据分配的磁盘柱面的连续空间和设定的分段存 放大小,将转化后的每个标准列划分出至少一个分段, 划分出的每一个分段的 大小为所述设定的分段存放大小。
进一步地, 如图 10示出的本发明实施例的空间确定单元的结构示意图, 空间确定单元 8020包括第一计算单元 80200和第一确定单元 80202, 其中 第一计算单元 80200 用于根据设定的存放列宽和所述待存储数据的列属 性, 计算需要标准列的数量;
第一确定单元 80202 用于根据计算出的需要标准列的数量和设定的分段 存放大小, 确定需要分配的磁盘柱面的连续空间。
进一步地, 如图 11示出的本发明的编辑存储模块的第二实施例的结构示 意图, 编辑存储模块 802包括: 空间确定单元 8020、 转化单元 8022和分段划 分单元 8024外, 还可以包括第一分段存储单元 8026, 用于按照转化后的每个 标准列的列顺序, 依次将每个标准列的一个分段存储在所述分配的磁盘柱面 中, 且每个分段中的数据按顺序连续存储; 其中, 同一个磁盘柱面中的所有分 段数据的数据行数相同。 具体地:
当每个标准列划分出至少两个分段时,第一分段存储单元 8026具体用于: 按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在所述 分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的磁盘 柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个磁盘柱面中的所 有分段数据的数据行数相同。
进一步地, 如图 12示出的本发明的编辑存储模块的第三实施例的结构示 意图, 当数据处理装置 80包括至少两个盘片时, 编辑存储模块 802包括: 空 间确定单元 8020、 转化单元 8022和分段划分单元 8024外, 还可以包括: 硬 件标定单元 8028和第二分段存储单元 80210, 其中
硬件标定单元 8028用于通过硬件标定构成同一个物理柱面的不同盘片的 起始位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐;
第二分段存储单元 80210 用于在所述同一个物理柱面上的每个盘片以所 述起始位置开始, 同时存入转化后的每个标准列的分段,且每个分段中的数据 按顺序连续存储; 其中, 所有分段数据的数据行数相同。
需要说明的是, 当数据处理装置 80为棵设备时, 所述磁盘柱面为至少一 个连续的逻辑柱面; 或当数据处理装置 80包括至少两个盘片时, 所述磁盘柱 面为所述至少两个盘片构成的物理柱面。
再进一步地, 数据处理装置 80还可以包括标准列管理表生成模块, 用于 生成标准列管理表, 用于存储设定的存放列宽信息、各标准列对应的分段信息 以及每个分段的起始位置信息。
再进一步地, 数据处理装置 80还可以包括起始信息获取模块和数据读取 模块, 其中,起始信息获取模块用于获取所述待读取数据对应的分段起始信息 以及转化信息;数据读取模块用于根据所述分段起始信息, 利用所述转化信息 读取对应的数据。
再进一步地, 如图 13示出的本发明实施例提供的起始信息获取模块的结 构示意图, 起始信息获取模块 130 包括第一查找单元 1300 和第一获取单元 1302, 其中
第一查找单元 1300用于从数据库列信息表或磁盘管理信息表中查找所述 待读取数据对应的标准列信息以及转化信息;
第一获取单元 1302用于从标准列管理表中获取查找到的标准列对应的各 个分段起始信息。
可理解的是, 数据处理装置 80中各功能模块的功能可根据上述方法实施 例中的方法具体实现, 这里不再赘述。 为了便于更好地实施本发明实施例的上述方案, 下面结合图 14示出的本 发明实施例提供的数据写入装置的结构示意图,对应上述方法项来描述装置项 的实施方式, 数据写入装置 140包括: 行号确定模块 1400、 分段位置查找模 块 1402、 行数据编辑模块 1404和行写入模块 1406, 其中
行号确定模块 1400用于确定向存储数据中写入行数据的行号; 该存储数 据以通过上述数据处理装置 80进行存储;
分段位置查找模块 1402用于根据所述行号查找待写入行数据在所述存储 数据中所属的分段位置;
行数据编辑模块 1404用于根据设定的存放列宽编辑所述待写入行数据, 以符合所述存储数据的格式;
行写入模块 1406用于在同一个磁盘柱面中, 根据所述分段位置在每一个 标准列的分段中对应写入行数据。
进一步地, 如图 15示出的本发明提供的分段位置查找模块的第一实施例 的结构示意图, 分段位置查找模块 1402包括第二查找单元 14020和第三查找 单元 14022, 其中
第二查找单元 14020用于根据所述行号,从数据库列信息表或磁盘管理信 息表中查找所述待写入行数据在所述存储数据中所属的分段; 第三查找单元 14022 用于从标准列管理表中获取所述查找出的分段对应 的起始信息。
再进一步地, 当数据写入装置 140包括至少两个盘片时, 如图 16示出的 本发明提供的分段位置查找模块的第二实施例的结构示意图,所述分段位置查 找模块 1402包括: 第二获取单元 14024和第四查找单元 14026, 其中
第二获取单元 14024 用于获取通过硬件标定构成同一个物理柱面的不同 盘片的起始位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐; 第四查找单元 14026用于根据所述起始位置和所述行号,查找待写入行数 据在所述存储数据中所属的分段的起始位置。
可理解的是,数据写入装置 140中各功能模块的功能可根据上述方法实施 例中的方法具体实现, 这里不再赘述。 为了便于更好地实施本发明实施例的上述方案,本发明还提供了用于配合 实施上述方案的相关设备。 下面结合图 17示出的本发明的电子设备的第一实 施例的结构示意图, 进行详细说明:
电子设备 170包括: 输入装置 1700、 输出装置 1702、 存储器 1704和处理 器 1706 (网络设备中的处理器 1706的数量可以一个或多个, 图 17中以一个 处理器为例)。 在本发明的一些实施例中, 输入装置 1700、 输出装置 1702、 存 储器 1704和处理器 1706可通过总线或者其它方式连接, 其中, 图 17中以通 过总线连接为例。
其中, 处理器 1706执行如下步骤:
获取列存储数据库中数据表的待存储数据; 根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合; 将所述待存储数据的同一行数据存储 在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续存 储。
进一步地, 处理器 1706根据分配的磁盘柱面的空间, 对所述待存储数据 进行划分和 /或组合包括:
根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱 面的连续空间; 根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或 合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存 放列宽;根据分配的磁盘柱面的连续空间和设定的分段存放大小,将转化后的 每个标准列划分出至少一个分段,划分出的每一个分段的大小为所述设定的分 段存放大小。
再进一步地, 处理器 1706根据设定的存放列宽和所述待存储数据的列数 属性, 确定需要分配的磁盘柱面的连续空间包括:
根据设定的存放列宽和所述待存储数据的列属性, 计算需要标准列的数 量; 根据计算出的需要标准列的数量和设定的分段存放大小,确定需要分配的 磁盘柱面的连续空间。
再进一步地, 处理器 1706将所述待存储数据的同一行数据存储在同一个 磁盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储包括: 按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个 磁盘柱面中的所有分段数据的数据行数相同。
再进一步地, 电子设备 170包括至少两个盘片时, 处理器 1706将所述待 存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中对每一 列分段中的数据进行连续存储包括:
通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片 上的起始位置在所述同一个物理柱面上对齐;
在所述同一个物理柱面上的每个盘片以所述起始位置开始,同时存入转化 后的每个标准列的分段, 且每个分段中的数据按顺序连续存储; 其中, 所有分 段数据的数据行数相同。
再进一步地, 当每个标准列划分出至少两个分段时, 处理器 1706按照转 化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在所述分配的 磁盘柱面中包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中。
再进一步地, 处理器 1706还执行: 生成标准列管理表, 用于存储设定的存放列宽信息、各标准列对应的分段 信息以及每个分段的起始位置信息。
再进一步地, 处理器 1706还执行如下步骤:
获取所述待读取数据对应的分段起始信息以及转化信息;根据所述分段起 始信息, 利用所述转化信息读取对应的数据。
再进一步地, 处理器 1706获取所述待读取数据对应的分段起始信息以及 转化信息包括:
从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准 列信息以及转化信息;从标准列管理表中获取查找到的标准列对应的各个分段 起始信息。
本发明实施例的电子设备 170包括但不限于计算机、数据仓库存储一体机 等电子设备。
可理解的是,电子设备 170中各功能模块的功能可根据上述方法实施例中 的方法具体实现, 这里不再赘述。 如图 18示出的本发明的电子设备的第二实施例的结构示意图, 进行详细 说明:
电子设备 180包括: 输入装置 1800、 输出装置 1802、 存储器 1804和处理 器 1806 (网络设备中的处理器 1806的数量可以一个或多个, 图 18中以一个 处理器为例)。 在本发明的一些实施例中, 输入装置 1800、 输出装置 1802、 存 储器 1804和处理器 1806可通过总线或者其它方式连接, 其中, 图 18中以通 过总线连接为例。
其中, 处理器 1806执行如下步骤:
确定向存储数据中写入行数据的行号;待读取数据通过本发明实施例的数 据处理方法进行存储;根据所述行号查找待写入行数据在所述存储数据中所属 的分段位置; 并根据设定的存放列宽编辑所述待写入行数据, 以符合所述存储 数据的格式; 在同一个磁盘柱面中,根据所述分段位置在每一个标准列的分段 中对应写入行数据。
再进一步地, 处理器 1806根据所述行号查找待写入行数据在所述存储数 据中所属的分段位置包括:
根据所述行号,从数据库列信息表或磁盘管理信息表中查找所述待写入行 数据在所述存储数据中所属的分段;从标准列管理表中获取所述查找出的分段 对应的起始信息。
再进一步地, 当电子设备 180包括至少两个盘片时, 处理器 1806根据所 述行号查找待写入行数据在所述存储数据中所属的分段位置包括:
获取通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个 盘片上的起始位置在所述同一个物理柱面上对齐;根据所述起始位置和所述行 号, 查找待写入行数据在所述存储数据中所属的分段的起始位置。
本发明实施例的电子设备 180包括但不限于计算机、数据仓库存储一体机 等电子设备。
可理解的是,电子设备 180中各功能模块的功能可根据上述方法实施例中 的方法具体实现, 这里不再赘述。
综上所述,通过实施本发明实施例,将所述待存储数据的同一行数据存储 在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续存 储, 磁盘只需一次旋转寻址即可完成行写入, 写入性能接近连续写, 解决了现 有技术中列数据库在运行时写入速度慢的技术问题,大大提高列存储数据库的 写入效率; 另外还可以通过硬件标定, 使得标准列在盘片之间是对齐的, 那么 当需要读取或者写入同一行但是不同列的数据时,由于所有磁头在物理位置上 是对齐的, 可以直接并行读入或者写入; 同时每一列的数据仍然在同一盘片上 保持连续, 读或者写一列数据仍旧是连续读的效率
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程, 是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算 机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。 其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory, ROM )或随机存储记忆体(Random Access Memory, RAM )等。
以上所揭露的仅为本发明一种较佳实施例而已,当然不能以此来限定本发 明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流 程, 并依本发明权利要求所作的等同变化, 仍属于发明所涵盖的范围。

Claims

权 利 要 求
1、 一种数据处理方法, 其特征在于, 包括:
获取列存储数据库中数据表的待存储数据;
根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合; 将 所述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中 对每一列分段中的数据进行连续存储。
2、 如权利要求 1所述的方法, 其特征在于, 所述根据分配的磁盘柱面的 空间, 对所述待存储数据进行划分和 /或组合包括:
根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱 面的连续空间;
根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或合并, 转化 为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存放列宽; 根据分配的磁盘柱面的连续空间和设定的分段存放大小,将转化后的每个 标准列划分出至少一个分段,划分出的每一个分段的大小为所述设定的分段存 放大小。
3、 如权利要求 2所述的方法, 其特征在于, 所述根据设定的存放列宽和 所述待存储数据的列属性, 确定需要分配的磁盘柱面的连续空间包括:
根据设定的存放列宽和所述待存储数据的列属性, 计算需要标准列的数 量;
根据计算出的需要标准列的数量和设定的分段存放大小,确定需要分配的 磁盘柱面的连续空间。
4、 如权利要求 2或 3所述的方法, 其特征在于, 所述将所述待存储数据 的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中 的数据进行连续存储包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个 磁盘柱面中的所有分段数据的数据行数相同。
5、 如权利要求 2或 3所述的方法, 其特征在于, 当本端设备包括至少两 个盘片时, 所述将所述待存储数据的同一行数据存储在同一个磁盘柱面中, 并 在所述磁盘柱面中对每一列分段中的数据进行连续存储包括:
通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片 上的起始位置在所述同一个物理柱面上对齐;
在所述同一个物理柱面上的每个盘片以所述起始位置开始,同时存入转化 后的每个标准列的分段, 且每个分段中的数据按顺序连续存储; 其中, 所有分 段数据的数据行数相同。
6、 如权利要求 4所述的方法, 其特征在于, 当每个标准列划分出至少两 个分段时, 所述按照转化后的每个标准列的列顺序,依次将每个标准列的一个 分段存储在所述分配的磁盘柱面中包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中。
7、 如权利要求 1-6任一项所述的方法, 其特征在于, 当本端设备为棵设 备时, 所述磁盘柱面为至少一个连续的逻辑柱面; 或
当本端设备包括至少两个盘片时,所述磁盘柱面为所述至少两个盘片构成 的物理柱面。
8、 如权利要求 2-6任一项所述的方法, 其特征在于, 还包括: 生成标准 列管理表, 用于存储设定的存放列宽信息、各标准列对应的分段信息以及每个 分段的起始位置信息。
9、 如权利要求 2-8任一项所述的方法, 其特征在于, 还包括: 获取所述待读取数据对应的分段起始信息以及转化信息;
根据所述分段起始信息, 利用所述转化信息读取对应的数据。
10、 如权利要求 9所述的方法, 其特征在于, 所述获取所述待读取数据对 应的分段起始信息以及转化信息包括:
从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准 列信息以及转化信息;
从标准列管理表中获取查找到的标准列对应的各个分段起始信息。
11、 一种数据写入方法, 其特征在于, 包括:
确定向存储数据中写入行数据的行号;所述存储数据以如权利要求 2所述 的数据处理方法进行存储;
根据所述行号查找待写入行数据在所述存储数据中所属的分段位置;并根 据设定的存放列宽编辑所述待写入行数据, 以符合所述存储数据的格式; 在同一个磁盘柱面中,根据所述分段位置在每一个标准列的分段中对应写 入行数据。
12、 如权利要求 11所述的方法, 其特征在于, 所述根据所述行号查找待 写入行数据在所述存储数据中所属的分段位置包括:
根据所述行号,从数据库列信息表或磁盘管理信息表中查找所述待写入行 数据在所述存储数据中所属的分段;
从标准列管理表中获取所述查找出的分段对应的起始信息。
13、 如权利要求 11所述的方法, 其特征在于, 当本端设备包括至少两个 盘片时,所述根据所述行号查找待写入行数据在所述存储数据中所属的分段位 置包括:
获取通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个 盘片上的起始位置在所述同一个物理柱面上对齐;
根据所述起始位置和所述行号,查找待写入行数据在所述存储数据中所属 的分段的起始位置。
14、 一种数据处理装置, 其特征在于, 包括:
数据获耳 ^莫块, 用于获取列存储数据库中数据表的待存储数据; 编辑存储模块, 用于根据分配的磁盘柱面的空间,对所述待存储数据进行 划分和 /或组合; 将所述待存储数据的同一行数据存储在同一个磁盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储。
15、 如权利要求 14所述的装置, 其特征在于, 所述编辑存储模块包括: 空间确定单元, 用于根据设定的存放列宽和所述待存储数据的列属性,确 定需要分配的磁盘柱面的连续空间;
转化单元,用于根据所述存放列宽对所述待存储数据的所有列进行拆分和
/或合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所 述存放列宽;
分段划分单元,用于根据分配的磁盘柱面的连续空间和设定的分段存放大 小,将转化后的每个标准列划分出至少一个分段, 划分出的每一个分段的大小 为所述设定的分段存放大小。
16、 如权利要求 15所述的装置, 其特征在于, 所述空间确定单元包括: 第一计算单元, 用于根据设定的存放列宽和所述待存储数据的列属性,计 算需要标准列的数量;
第一确定单元,用于根据计算出的需要标准列的数量和设定的分段存放大 小, 确定需要分配的磁盘柱面的连续空间。
17、 如权利要求 15或 16所述的装置, 其特征在于, 所述编辑存储模块还 包括:
第一分段存储单元, 用于按照转化后的每个标准列的列顺序,依次将每个 标准列的一个分段存储在所述分配的磁盘柱面中,且每个分段中的数据按顺序 连续存储; 其中, 同一个磁盘柱面中的所有分段数据的数据行数相同。
18、 如权利要求 15或 16所述的装置, 其特征在于, 当所述数据处理装置 包括至少两个盘片时, 所述编辑存储模块还包括:
硬件标定单元,用于通过硬件标定构成同一个物理柱面的不同盘片的起始 位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐;
第二分段存储单元,用于在所述同一个物理柱面上的每个盘片以所述起始 位置开始, 同时存入转化后的每个标准列的分段,且每个分段中的数据按顺序 连续存储; 其中, 所有分段数据的数据行数相同。
19、 如权利要求 17所述的装置, 其特征在于, 当每个标准列划分出至少 两个分段时, 所述第一分段存储单元具体用于:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个磁盘柱面中 的所有分段数据的数据行数相同。
20、 如权利要求 14-19所述的装置, 其特征在于, 当所述数据处理装置为 棵设备时, 所述磁盘柱面为至少一个连续的逻辑柱面; 或
当所述数据处理装置包括至少两个盘片时,所述磁盘柱面为所述至少两个 盘片构成的物理柱面。
21、 如权利要求 15-19所述的装置, 其特征在于, 所述数据处理装置还包 括:
标准列管理表生成模块, 用于生成标准列管理表, 用于存储设定的存放列 宽信息、 各标准列对应的分段信息以及每个分段的起始位置信息。
22、 如权利要求 15-21任一项所述的装置, 其特征在于, 所述数据处理装 置还包括:
起始信息获取模块,用于获取所述待读取数据对应的分段起始信息以及转 化信息;
数据读取模块, 用于根据所述分段起始信息, 利用所述转化信息读取对应 的数据。
23、 如权利要求 22所述的装置, 其特征在于, 所述起始信息获取模块包 括:
第一查找单元,用于从数据库列信息表或磁盘管理信息表中查找所述待读 取数据对应的标准列信息以及转化信息;
第一获取单元,用于从标准列管理表中获取查找到的标准列对应的各个分 段起始信息。
24、 一种数据写入装置, 其特征在于, 包括:
行号确定模块, 用于确定向存储数据中写入行数据的行号; 所述存储数据 以通过如权利要求 15所述的数据处理装置进行存储;
分段位置查找模块,用于根据所述行号查找待写入行数据在所述存储数据 中所属的分段位置;
行数据编辑模块,用于根据设定的存放列宽编辑所述待写入行数据, 以符 合所述存储数据的格式;
行写入模块, 用于在同一个磁盘柱面中,根据所述分段位置在每一个标准 列的分段中对应写入行数据。
25、 如权利要求 24所述的装置, 其特征在于, 所述分段位置查找模块包 括:
第二查找单元, 用于根据所述行号,从数据库列信息表或磁盘管理信息表 中查找所述待写入行数据在所述存储数据中所属的分段;
第三查找单元,用于从标准列管理表中获取所述查找出的分段对应的起始 信息。
26、 如权利要求 24所述的装置, 其特征在于, 当所述数据写入装置包括 至少两个盘片时, 所述分段位置查找模块包括:
第二获取单元,用于获取通过硬件标定构成同一个物理柱面的不同盘片的 起始位置, 其中每个盘片上的起始位置在所述同一个物理柱面上对齐;
第四查找单元, 用于根据所述起始位置和所述行号, 查找待写入行数据在 所述存储数据中所属的分段的起始位置。
27、 一种电子设备, 其特征在于, 包括: 输入装置、 输出装置、 存储器和 处理器;
其中, 所述处理器执行如下步骤:
获取列存储数据库中数据表的待存储数据; 根据分配的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合; 将所述待存储数据的同一行数据存储 在同一个磁盘柱面中,并在所述磁盘柱面中对每一列分段中的数据进行连续存 储。
28、 如权利要求 27所述的电子设备, 其特征在于, 所述处理器根据分配 的磁盘柱面的空间, 对所述待存储数据进行划分和 /或组合包括:
根据设定的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱 面的连续空间; 根据所述存放列宽对所述待存储数据的所有列进行拆分和 /或 合并, 转化为至少一个标准列, 并记录转化信息; 所述标准列的列宽为所述存 放列宽; 根据分配的磁盘柱面的连续空间和设定的分段存放大小,将转化后的 每个标准列划分出至少一个分段,划分出的每一个分段的大小为所述设定的分 段存放大小。
29、 如权利要求 28所述的电子设备, 其特征在于, 所述处理器根据设定 的存放列宽和所述待存储数据的列属性,确定需要分配的磁盘柱面的连续空间 包括:
根据设定的存放列宽和所述待存储数据的列属性, 计算需要标准列的数 量; 根据计算出的需要标准列的数量和设定的分段存放大小,确定需要分配的 磁盘柱面的连续空间。
30、 如权利要求 28或 29所述的电子设备, 其特征在于, 所述处理器将所 述待存储数据的同一行数据存储在同一个磁盘柱面中,并在所述磁盘柱面中对 每一列分段中的数据进行连续存储包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面中, 且每个分段中的数据按顺序连续存储; 其中, 同一个 磁盘柱面中的所有分段数据的数据行数相同。
31、 如权利要求 28或 29所述的电子设备, 其特征在于, 所述电子设备包 括至少两个盘片时,所述处理器将所述待存储数据的同一行数据存储在同一个 磁盘柱面中, 并在所述磁盘柱面中对每一列分段中的数据进行连续存储包括: 通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个盘片 上的起始位置在所述同一个物理柱面上对齐;
在所述同一个物理柱面上的每个盘片以所述起始位置开始,同时存入转化 后的每个标准列的分段, 且每个分段中的数据按顺序连续存储; 其中, 所有分 段数据的数据行数相同。
32、 如权利要求 30所述的电子设备, 其特征在于, 当每个标准列划分出 至少两个分段时, 所述处理器按照转化后的每个标准列的列顺序,依次将每个 标准列的一个分段存储在所述分配的磁盘柱面中包括:
按照转化后的每个标准列的列顺序,依次将每个标准列的一个分段存储在 所述分配的磁盘柱面后,再依次将每个标准列的下一个分段存储在所述分配的 磁盘柱面中。
33、 如权利要求 27-32任一项所述的电子设备, 其特征在于, 当所述电子 设备为棵设备时, 所述磁盘柱面为至少一个连续的逻辑柱面; 或
当所述电子设备包括至少两个盘片时,所述磁盘柱面为所述至少两个盘片 构成的物理柱面。
34、 如权利要求 28-32任一项所述的电子设备, 其特征在于, 所述处理器 还执行:
生成标准列管理表, 用于存储设定的存放列宽信息、各标准列对应的分段 信息以及每个分段的起始位置信息。
35、 如权利要求 28-34任一项所述的电子设备, 其特征在于, 所述处理器 还执行如下步骤:
获取所述待读取数据对应的分段起始信息以及转化信息;根据所述分段起 始信息, 利用所述转化信息读取对应的数据。
36、 如权利要求 35所述的电子设备, 其特征在于, 所述处理器获取所述 待读取数据对应的分段起始信息以及转化信息包括:
从数据库列信息表或磁盘管理信息表中查找所述待读取数据对应的标准 列信息以及转化信息;从标准列管理表中获取查找到的标准列对应的各个分段 起始信息。
37、 一种电子设备, 其特征在于, 包括: 输入装置、 输出装置、 存储器和 处理器;
其中, 所述处理器执行如下步骤:
确定向存储数据中写入行数据的行号;所述存储数据以如权利要求 2所述 的数据处理方法进行存储;根据所述行号查找待写入行数据在所述存储数据中 所属的分段位置; 并根据设定的存放列宽编辑所述待写入行数据, 以符合所述 存储数据的格式; 在同一个磁盘柱面中,根据所述分段位置在每一个标准列的 分段中对应写入行数据。
38、 如权利要求 37所述的电子设备, 其特征在于, 所述处理器根据所述 行号查找待写入行数据在所述存储数据中所属的分段位置包括:
根据所述行号,从数据库列信息表或磁盘管理信息表中查找所述待写入行 数据在所述存储数据中所属的分段;从标准列管理表中获取所述查找出的分段 对应的起始信息。
39、 如权利要求 37所述的电子设备, 其特征在于, 当所述电子设备包括 至少两个盘片时,所述处理器根据所述行号查找待写入行数据在所述存储数据 中所属的分段位置包括:
获取通过硬件标定构成同一个物理柱面的不同盘片的起始位置,其中每个 盘片上的起始位置在所述同一个物理柱面上对齐;根据所述起始位置和所述行 号, 查找待写入行数据在所述存储数据中所属的分段的起始位置。
PCT/CN2014/071931 2014-02-10 2014-02-10 一种数据处理和写入方法及相关装置 WO2015117280A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP14881915.4A EP3093772B1 (en) 2014-02-10 2014-02-10 Data processing method, data writing method, and related apparatus
PCT/CN2014/071931 WO2015117280A1 (zh) 2014-02-10 2014-02-10 一种数据处理和写入方法及相关装置
CN201480001004.XA CN105408893B (zh) 2014-02-10 2014-02-10 一种数据处理和写入方法及相关装置
US15/231,914 US9710504B2 (en) 2014-02-10 2016-08-09 Data processing and writing method and related apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/071931 WO2015117280A1 (zh) 2014-02-10 2014-02-10 一种数据处理和写入方法及相关装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/231,914 Continuation US9710504B2 (en) 2014-02-10 2016-08-09 Data processing and writing method and related apparatus

Publications (1)

Publication Number Publication Date
WO2015117280A1 true WO2015117280A1 (zh) 2015-08-13

Family

ID=53777122

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/071931 WO2015117280A1 (zh) 2014-02-10 2014-02-10 一种数据处理和写入方法及相关装置

Country Status (4)

Country Link
US (1) US9710504B2 (zh)
EP (1) EP3093772B1 (zh)
CN (1) CN105408893B (zh)
WO (1) WO2015117280A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019014A (zh) * 2017-12-19 2019-07-16 华为技术有限公司 向文件系统写入数据记录的方法和装置
CN110881277A (zh) * 2018-07-04 2020-03-13 华为技术有限公司 一种数据存储方法、装置及相关设备
US11227065B2 (en) * 2018-11-06 2022-01-18 Microsoft Technology Licensing, Llc Static data masking
CN112015672A (zh) * 2020-08-28 2020-12-01 北京浪潮数据技术有限公司 一种存储系统中数据处理方法、装置、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7730106B2 (en) * 2006-12-28 2010-06-01 Teradata Us, Inc. Compression of encrypted data in database management systems
CN102682108A (zh) * 2012-05-08 2012-09-19 同方光盘股份有限公司 一种行列混合的数据库存储方法
CN103020305A (zh) * 2012-12-29 2013-04-03 天津南大通用数据技术有限公司 一种针对二维数据表的高效索引及创建和查询方法
CN103177055A (zh) * 2011-12-22 2013-06-26 Sap股份公司 存储为行存储和列存储二者的混合数据库表
CN103400587A (zh) * 2013-06-28 2013-11-20 华为技术有限公司 数据写入的方法及机械硬盘
CN103548024A (zh) * 2011-05-31 2014-01-29 国际商业机器公司 用于通过在柱状数据结构中提供数据记录而确定规则的方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5345575A (en) * 1991-09-26 1994-09-06 Hewlett-Packard Company Write optimized disk storage device
US5802344A (en) * 1995-11-03 1998-09-01 International Business Machines Corporation Method and apparatus for dynamic segment allocation in log structured arrays
US20030140139A1 (en) * 2002-01-14 2003-07-24 Richard Marejka Self-monitoring and trending service system with a cascaded pipeline with a unique data storage and retrieval structures
US7921142B2 (en) * 2007-01-08 2011-04-05 International Business Machines Corporation Method and apparatus for storing and accessing data records on solid state disks
US8862625B2 (en) * 2008-04-07 2014-10-14 Teradata Us, Inc. Accessing data in a column store database based on hardware compatible indexing and replicated reordered columns
US8782100B2 (en) * 2011-12-22 2014-07-15 Sap Ag Hybrid database table stored as both row and column store
CN103294702A (zh) * 2012-02-27 2013-09-11 上海淼云文化传播有限公司 一种数据处理方法、装置及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7730106B2 (en) * 2006-12-28 2010-06-01 Teradata Us, Inc. Compression of encrypted data in database management systems
CN103548024A (zh) * 2011-05-31 2014-01-29 国际商业机器公司 用于通过在柱状数据结构中提供数据记录而确定规则的方法
CN103177055A (zh) * 2011-12-22 2013-06-26 Sap股份公司 存储为行存储和列存储二者的混合数据库表
CN102682108A (zh) * 2012-05-08 2012-09-19 同方光盘股份有限公司 一种行列混合的数据库存储方法
CN103020305A (zh) * 2012-12-29 2013-04-03 天津南大通用数据技术有限公司 一种针对二维数据表的高效索引及创建和查询方法
CN103400587A (zh) * 2013-06-28 2013-11-20 华为技术有限公司 数据写入的方法及机械硬盘

Also Published As

Publication number Publication date
EP3093772A1 (en) 2016-11-16
CN105408893A (zh) 2016-03-16
US20160350343A1 (en) 2016-12-01
EP3093772A4 (en) 2017-02-22
CN105408893B (zh) 2019-04-26
EP3093772B1 (en) 2018-07-18
US9710504B2 (en) 2017-07-18

Similar Documents

Publication Publication Date Title
US11799959B2 (en) Data processing method, apparatus, and system
CN104866497B (zh) 分布式文件系统列式存储的元数据更新方法、装置、主机
US8352490B2 (en) Method and system for locating update operations in a virtual machine disk image
US9134908B2 (en) Logical volume space sharing
CN106663047A (zh) 用于优化的签名比较和数据复制的系统和方法
CN102821138B (zh) 一种适用于云存储系统的元数据分布式存储方法
JP6262874B2 (ja) データベース実現方法
CN103140840B (zh) 数据管理的方法及装置
CN103544045A (zh) 一种基于hdfs的虚拟机镜像存储系统及其构建方法
CN102693286B (zh) 一种对文件内容与元数据进行组织管理的方法
WO2015117280A1 (zh) 一种数据处理和写入方法及相关装置
CN103488710B (zh) 大数据页中高效存储非定长数据方法
WO2021073241A1 (zh) 一种基于磁盘存储的数据读取方法、装置及设备
WO2019223377A1 (zh) 文件处理方法、装置、设备及存储介质
JP6982121B2 (ja) 記憶デバイスに記憶されたデータに関連付けられたメディア情報を特定する方法及び装置
CN103425785A (zh) 数据存储系统及其用户数据存储、读取方法
TWI397060B (zh) 物件導向儲存裝置之磁碟配置方法
CN107728948A (zh) 一种存储器性能优化方法及装置、计算机设备
CN105224607B (zh) 一种模拟云存储设备的虚拟文件系统设计方法
WO2018006577A1 (zh) 基于光盘的数据库双核存储系统及利用该系统的方法
CN101751390B (zh) 物件导向储存装置的磁盘配置方法
TWI476680B (zh) Archives System for File Management of Flash Memory
TWI453738B (zh) 電子裝置及其儲存媒體之分割方法
CN108228673B (zh) 一种文件快速合并的方法和系统
TW201335882A (zh) 圖形處理單元及其圖形資料存取方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480001004.X

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14881915

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014881915

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014881915

Country of ref document: EP